a foreign key constraint fails

今天遇到一个问题,一对一级联保存时,报错如下:

Cannot add or update a child row: a foreign key constraint fails

解决方法:

MySQL 的可视化工具里面的对应表的外键默认为不级联,改成级联之后就可以啦。

原文地址:https://www.cnblogs.com/hzhtracy/p/5158929.html