Can't Drop foreign key in MySQL

Please run an SHOW CREATE TABLE course; to make sure instructorID is the name of foreign key constraint.

Additional: The error means MySQL searches for a foreign key constraint named "InstructorID" but there is no constraint with such name, maybe this is your column name, but you have to use the constraint name to delete foreign keys.


After you run SHOW CREATE table course; you should find the fk symbol which is commonly like the one bellow:

(course_ibfk_1) 

it may differ according to your mysql version you are using then drop the foreign key using the fk symbol as follow :

alter table course drop foreign key course_ibfk_1;

You need to delete the 'foreign key constraint' and the 'key'.

Alter Table <table name> drop foreign key <constraint_name> 
Alter table <table name> drop key <column name>

Tags:

Mysql