你的位置:首页 > 信息动态 > 新闻中心
信息动态
联系我们

Mysql删除表提示Cannot truncate a table referenced in a foreign key constraint解决办法

2021/11/9 18:34:43

一、问题描述:
[Err] 1701 -Cannot truncate a table referenced in a foreign key constraint …
二、解决办法
1.删除之前先执行
SET foreign_key_checks = 0;(删除外键约束)
2.删除完之后再执行
SET foreign_key_checks = 1;(启动外键约束)
3.查询
SELECT @@FOREIGN_KEY_CHECKS; (用来检查状态)