解决Mysql cannot truncate a table refrenenced in a foreign key constraint

问题

truncate xx时,提示cannot truncate a table refrenenced in a foreign key constraint

解决

You can do truncate by skipping foreign key checks.

SET FOREIGN_KEY_CHECKS = 0; 
TRUNCATE table1; 
SET FOREIGN_KEY_CHECKS = 1;

你可能感兴趣的:(解决Mysql cannot truncate a table refrenenced in a foreign key constraint)