MySQL Drop foreign key

MySQL Drop foreign key

Drop foreign key from MySQL table using alter table syntax.

MySQL Drop foreign key syntax

ALTER TABLE table_name DROP FOREIGN KEY foreign_key_name;

Drop foreign key example

ALTER TABLE `books` 
DROP FOREIGN KEY fk_product_id;

ALTER TABLE `books` 
DROP INDEX fk_product_id;

Output

table `books` altered.