Cannot add or update a child row: a foreign key constraint fails 当我们在对表进行外键约束的时候 alter table 表名 add constraint 外键名 foreign key(列)references 表名(主键)on delete 级联操作 MYSQL会报这个错误的原因是 被设置的为外键的列中有和另一个表主键不同的值,导致失败 来源:CSDN作者:八戒;链接:https://blog.csdn.net/weixin_44799092/article/details/103647980 标签 外键 主键约束 update