MySQL: Force Drop Table with Foreign Keys

June 6th, 2009 by jeremychone

If you try to drop a table that has some foreign keys, you will get an exception.

mysql> SET foreign_key_checks = 0;
mysql> drop table ...
mysql> SET foreign_key_checks = 1;

3 Responses to “MySQL: Force Drop Table with Foreign Keys”

  1. Illl Says:

    Thanks

  2. Pratik Gandhi Says:

    Thank you for this! I am not a great programmer and could not figure out all this database stuff without your help!

  3. fred Says:

    Excellent tip, thanks

Leave a Reply