MySQL添加外键报错 - referencing column 'xx' and referenced column 'xx' in foreign key constraint 'xx' are incompatible

MySQL给两个表添加外键时,报错

 

翻译意思是:外键约束“xx”中的引用列“xx”和引用列“xx”不兼容

说明两个表关联的列数据类型不一致,比如:varchar 与 int,或者 int无符号 与 int有符号,都不行,必须要一模一样才可以,修改完成后,就可以添加外键了。

 

posted @ 2020-05-16 10:28  jardeng  阅读(15144)  评论(0编辑  收藏  举报