原文: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 select table c ...

2021-02-25 10:01 0 329 推荐指数:

查看详情

 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM