0

I would like to know if it's possible in InnoDB in MySQL to have a table(db:3306 with password) with foreign key that references another table in a different port database(db:3307 with no password)? And if so, how this can be done ?

I have tried this one

ALTER TABLE `treat_well`.`tw_venue` ADD CONSTRAINT `FK_tw_venue_user_id` FOREIGN KEY (`user_id`) 
REFERENCES `bitnami_dreamfactory`.`user` (`id`) ON DELETE CASCADE  ON UPDATE CASCADE;

It throws error as follows

Error Code : 1215 Cannot add foreign key constraint

Advanced Thanks..

user3391137
  • 431
  • 8
  • 26
  • 3
    http://stackoverflow.com/q/3905013/ – Drew Feb 20 '16 at 05:50
  • @Drew that link refers to connect via same port i tried that one it's not working. Actually i'm trying to connect two dbs via different ports. – user3391137 Feb 20 '16 at 07:19
  • What you are describing lacks a ton of detail for anyone to help. But if you are saying FK's across two different servers out of the box? No. What is confusing is that it is not a db with a listening port. It is a server. – Drew Feb 20 '16 at 11:05
  • I have two databases in two ports(3306,3307) of server. I want to set the foreign key constraint between two tables' user_id of their databases. – user3391137 Feb 20 '16 at 11:24
  • describe your server setup. How many physical servers. Let's give them names. How many daemon instances. We don't have time for vagueness. Trying to help – Drew Feb 20 '16 at 11:36
  • i have installed the wamp server its database server is running port 3307 after it i have installed the dreamfactory its mariadb is running port 3306. – user3391137 Feb 20 '16 at 11:39
  • Look at this question for 2 separate servers: http://stackoverflow.com/questions/673087 – Drew Feb 20 '16 at 11:57
  • This is the link that i expect. Thanks – user3391137 Feb 20 '16 at 12:11

0 Answers0