Drop Column with foreign key in MySQL

Use this given below query to find the name of the foreign key.

SHOW CREATE TABLE forms_main;

Then once u got the key, execute drop foreign key command

alter TABLE `forms_main`
drop FOREIGN key `forms_main_ibfk_1`;

Then execute the drop column command

ALTER TABLE `forms_main` DROP `company_id`;

ALTER TABLE db_name.table_name DROP FOREIGN KEY foreign_key; ALTER TABLE test.exam DROP INDEX id ;


Your DROP FOREIGN KEY syntax is using the wrong key name. It's trying to drop your "plain" index on the home_lang field. It's NOT the foreign key itself.

CONSTRAINT `personal_info_ibfk_1` FOREIGN KEY (`home_lang`) REFERENCES `language_list` (`ll_id`)
            ^^^^^^^^^^^^^^^^^^^^^--- THIS is the name of the foreign key

Try:

ALTER TABLE personal_info DROP FOREIGN KEY `personal_info_ibfk_1`