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

mysql 删除表时提示有外键

 

mysql> drop tables auth_group;
ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails
mysql>
mysql>
mysql>
mysql> SET FOREIGN_KEY_CHECKS = 0;
Query OK, 0 rows affected (0.00 sec)

mysql> drop tables auth_group;
Query OK, 0 rows affected (0.01 sec)

最后要要修改原样
mysql> SET FOREIGN_KEY_CHECKS = 1;
Query OK, 0 rows affected (0.00 sec)

mysql>

posted @ 2017-11-15 17:35  左丿仔  阅读(475)  评论(0编辑  收藏  举报