mysql : Cannot truncate a table referenced in a foreign key constraint

ERROR 1701 (42000): Cannot truncate a table referenced in a foreign key constraint (mytest.instance, CONSTRAINT instance_ibfk_1 FOREIGN KEY (GroupID) REFERENCES mytest.mygroup (ID))


SET FOREIGN_KEY_CHECKS=0;
TRUNCATE table1;
TRUNCATE table2;
TRUNCATE table3;
SET FOREIGN_KEY_CHECKS=1;
post-author