Disable foreign key checks in MySQL

November 24, 2008 – 22:47

Disabling foreign key checks in MySQL is usefull when you are dealing with tables that use foreign keys (InnoDB engine).

MySQL logo

MySQL logo

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:

SET FOREIGN_KEY_CHECKS = 0;

To enable the foreign key checks use the opposite command:

SET FOREIGN_KEY_CHECKS = 1;

Tags: , ,

  1. One Response to “Disable foreign key checks in MySQL”

  2. Thanks!
    Safed me from a lot of trouble :)

    Flo

    By Flo on Aug 27, 2009

Post a Comment