[MySQL] How to Drop foreign key
How to Drop a Foreign Key in MySQL
ALTER TABLE 'table_name' DROP FOREIGN KEY 'foreign_key'
and I got an error as below:
#1091 - Can't DROP 'foreign_key'; check that column/key exists
- Find the foreign key contraint using
SHOW CREATE TABLE 'table_name';
Normally it’s ‘table_name_ibfk_1’.
- Drop Foreign key
ALTER TABLE 'table_name' DROP FOREIGN KEY 'table_name_ibfk_1'; ALTER TABLE 'table_name' DROP INDEX 'column';
Reference:
https://stackoverflow.com/questions/25079645/cant-drop-foreign-key-in-mysql
Any advice and suggestions are welcome and appreciated!