mysql ERROR 1451 (23000)
问题描述:
报错如下:
ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint
提示有外键约束,不能删除父表记录,然而父表记录对应的子表中并没有相关记录
解决方式:
SET FOREIGN_KEY_CHECKS=0;
delete from account where id=22687 and name like '%xxxx%';
SET FOREIGN_KEY_CHECKS=1;