We can remove FOREIGN KEY constraint from a column of an existing table by using DROP keyword along with ALTER TABLE statement.
ALTER TABLE table_name DROP FOREIGN KEY constraint_name
Here constraint name is the name of foreign key constraint which we applied while creating the table. If no constraint name is specified then MySQL will provide constraint name which can be checked by SHOW CREATE TABLE statement.
The following query will delete the FOREIGN KEY constraint from ‘orders’ table −
mysql> Alter table orders DROP FOREIGN KEY orders_ibfk_1; Query OK, 0 rows affected (0.22 sec) Records: 0 Duplicates: 0 Warnings: 0