Disable foreign key checks in MySQL

Cristian Radulescu • November 24, 2008

Disabling foreign key checks in MySQL is usefull when you are dealing with tables that use foreign keys (InnoDB engine). You can not delete (drop) multiple tables, a parent table or a child table until you disable foreign key checks four your current database.

The sql command is:

SET FOREIGN_KEY_CHECKS = 0;

To re-enable the foreign key checks use:

SET FOREIGN_KEY_CHECKS = 1;