ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails

"ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails​"

原因是Foreign Key的约束,通过关闭Foreign Key检查后,删除SQL表格成功:

Set FOREIGN_KEY_CHECKS = 0; 关闭Foreign Key检查​

drop table Table_Name;

Set FOREIGN_KEY_CHECKS = 1; 恢复Foreign Key检查​

posted @ 2019-07-18 15:21  qinliang  阅读(2093)  评论(0编辑  收藏  举报