Disable foreign key checks in MySQL

By | 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 to disable foreign key checks is:


To  enable the foreign key checks use the opposite command:


5 thoughts on “Disable foreign key checks in MySQL

  1. Tracy Hamlin

    OMG – that is SO awesome! so much easier to deal with than SQL Server. THANK YOU!!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.