Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Disabling Foreign Key Constraints

How to enable/disable foreign keys



9:53 pm on Sep 4, 2010 (gmt 0)

5+ Year Member

I have a table in phpMyAdmin that has a primary key. I'd like to drop the table to prepare for a new import; but I can't do that without disabling the table's associated foreign keys; otherwise I get constraint errors. I can disable a foreign key by simply temporarily deleting the key in the associated table. However, is there a simpler way of enabling/disabling foreign keys in phpMyAdmin. If not, what is the simplest way of automating this mundane task?


10:34 pm on Sep 4, 2010 (gmt 0)

5+ Year Member


You should be able to use the query:

To disable foreign key checks, set it to one to re-enable after you've finished.



6:20 pm on Sep 5, 2010 (gmt 0)

5+ Year Member

Excellent!...............thank you.

Featured Threads

Hot Threads This Week

Hot Threads This Month