MySQL table data delete foreign key constraint

[Err] 1701 -Cannot truncate a table referenced in a foreign key constraint …

-- 移除外键约束
SET FOREIGN_KEY_CHECKS = 0; 
TRUNCATE table $table_name; 
-- 启用外键约束
SET FOREIGN_KEY_CHECKS = 1;

Guess you like

Origin www.cnblogs.com/yueyun00/p/12131712.html