Deleting foreign key tables on phpmyadmin? cannot drop index: needed in foreign key constraint Deleting foreign key tables on phpmyadmin? cannot drop index: needed in foreign key constraint sql sql

Deleting foreign key tables on phpmyadmin? cannot drop index: needed in foreign key constraint


In "Structure" tab, click on "see relational view" below the fields.Here you can remove the foreign keys by selecting an empty value in the dropdown.


You have to delete the foreign key with an alter statement:

ALTER TABLE yourtable DROP CONSTRAINT yourforeignkeyname

You might be able to force drop it as well (works in the MySQL console but might not work in phpmyadmin as I'm not sure how sessions are handled)

SET FOREIGN_KEY_CHECKS=0; DROP TABLE yourtable;

Note: this is very dangerous and not recommended if you're seriously using foreign keys.