Friday, March 30, 2012

Cannot drop index needed in a foreign key constraint

When you receive the message
"MySQL Cannot drop index needed in a foreign key constraint"
You have to drop the foreign key. Foreign keys in MySQL automatically create an index on the table (There was a SO Question on the topic).

ALTER TABLE mytable DROP FOREIGN KEY mytable_ibfk_1;

No comments:

Post a Comment