Mysql错误1452 - Cannot add or update a child row: a foreign key constraint fails 原因及解决方法

报错的原因大概分为三种: 原因一: 添加的外键列与另一个表的唯一索引列(一般是主键)的数据类型不同 原因二: 要添加外键的表类型与另一个表的存储引擎是不是都为innodb引擎 #查看表引擎 法一: show create table 表名; 法二:show table status from 数据库 where name=‘表名’; 法三:use information_schema; selec
相关文章
相关标签/搜索