tags:

views:

35

answers:

2

Is it possible to reference (InnoDB) a foreign key in another database in MySQL?

Is this bad practice?

+1  A: 

Yes, it's possible on the same DB server. Prefix the database name when adding the constraint, e.g. databasename.tablename.fieldname. Watch your user permissions.

I don't consider it bad practice, though it's not something that should be happening very often.

Pete
+2  A: 

Hello,

Yes, You can use reference a foreign key in another database in MYSQL.

Thanks.

Yunus Malek