truncate table 时报外键约束的表时报ERROR 1701(42000)的解决

ERROR 1701 (42000): Cannot truncate a table referenced in a foreign key
constraint (`furion`.`tbl_frn_alert`, CONSTRAINT `FK353A3CBEB139CC08`
FOREIGN KEY (`endpt_id`) REFERENCES `furion`.`tbl_frn_endpt` (`id`))

ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (` up`.`auth_assignment`, CONSTRAINT `auth_assignment_ibfk_1` FOREIGN KEY (`item_name`) REFERENCES `auth_item` (`name`) ON DELETE CASCADE ON UPDATE CASCADE)
my

解决方法:

mysql> SET foreign_key_checks=0;

 删除后

mysql> SET foreign_key_checks=1;

发布了216 篇原创文章 · 获赞 89 · 访问量 45万+

猜你喜欢

转载自blog.csdn.net/eagle89/article/details/91526736