Mysql添加数据时失败 Cannot add or update a child row: a foreign key constraint fails

    xiaoxiao2021-03-25  66

    用SSM 框架时 添加数据时遇到的问题  Cannot add or update a child row: a foreign key constraint fails

    原因:

    设置的外键与外键对应的表的主键值不匹配(换句话说你添加外键值在他所对的表中不存在)。

    解决方法:

    找出不匹配的值修改。

    或者清空两表数据。

    转载请注明原文地址: https://ju.6miu.com/read-36781.html

    最新回复(0)