MySQL : ERROR 1215 (HY000): Cannot add foreign key constraint

后端 未结 16 1955
误落风尘
误落风尘 2020-11-30 01:37

I have read Database system concepts, 6th edition, Silberschatz. I\'m going to implement the university database system shown in chapter 2 on OS X

16条回答
  •  醉酒成梦
    2020-11-30 02:04

    I don't meet the problem as you. But I get the same ERROR Message. So I mark it down here for others' convience.

    Check the charset of two table if the column type is char or varchar. I use a charset=gbk, but I create a new table whose default charset=utf8. So the charset is not the same.

    ERROR 1215 (HY000): Cannot add foreign key constraint
    

    To solve it is to use the same charset. For example utf8.

提交回复
热议问题