Posts Tagged ‘foreign key’

MySQL InnoDB table truncate fails because of foreign keys

Thursday, April 12, 2012 8:51 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;

This was posted under category: Database Tags: , , , ,