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检查​

原文地址:https://www.cnblogs.com/ccielife/p/11207581.html