当前位置:网站首页>ERROR 1215 (HY000): Cannot add foreign key constraint

ERROR 1215 (HY000): Cannot add foreign key constraint

2022-06-11 06:10:00 Glutinous rice balls

The cause of this error may be :

  1. A Table main construction and B Table foreign key data type 、 Inconsistent constraints .

  2. The storage engines of the two data tables are inconsistent .

  3. The character sets of the two tables are inconsistent .

  4. ...

My mistake :

be under construction B Cannot add foreign key while table .

  reason : What I use MySQL The storage engine for version data tables is InnoDB, I changed the storage engine of the main table to MyISAM.

  solve : Just change it back .

The table was built successfully .

原网站

版权声明
本文为[Glutinous rice balls]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203020529569921.html