当前位置: 代码迷 >> 综合 >> MySQL错误号1451-Cannot delete or update a parent row: a foreign key constraint fails
  详细解决方案

MySQL错误号1451-Cannot delete or update a parent row: a foreign key constraint fails

热度:39   发布时间:2024-01-05 05:27:21.0
在SQLyog中删除一张表时候,出现

Error No. 1451
Cannot delete or update a parent row: a foreign key constraint fails
Cannot delete or update a parent row: a foreign key constraint fails

当然啦,我是在DOS命令窗口直接运行下述命令的。因为在前台,实在是该不了,一删就出现异常,于是只能在DOS下启动MySql,运行sql语句

关闭外键检测

SET FOREIGN_KEY_CHECKS = 0;

执行操作

SET FOREIGN_KEY_CHECKS = 1;

其他:

关闭唯一性校验

set unique_checks=0;

set unique_checks=1;

  相关解决方案