MySQL InnoDB table truncate fails because of foreign keys
Thursday, April 12, 2012 8:51Posted in category Database
No Comments
If trying to truncate MySQL InnoDB tables and you are getting an error because of foreign keys constraints try disabling the foreign keys checks.
SET FOREIGN_KEY_CHECKS = 0;
..
TRUNCATE tableName;
TRUNCATE tableName2;
..
SET FOREIGN_KEY_CHECKS = 1;
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.