另一个数据库中的MySQL外键? [英] MySQL Foreign Key in Table in Another Database?
本文介绍了另一个数据库中的MySQL外键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在MySQL的另一个数据库中引用(InnoDB)外键?
Is it possible to reference (InnoDB) a foreign key in another database in MySQL?
这是不好的做法吗?
推荐答案
是的,它可能在同一个DB服务器上。添加约束时,前缀数据库名称,例如 databasename.tablename.fieldname
。观看您的用户权限。
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.
这篇关于另一个数据库中的MySQL外键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文