简体   繁体   中英

I am unable to drop a foreign key in mysql

I am trying to drop a foriegn key in php admin (mysql) so I am performing this code below:

`ALTER TABLE Image_Question DROP INDEX FK_QuestionSession`

Problem is though that I am receiving this error:

#1553 - Cannot drop index 'FK_QuestionSession': needed in a foreign key constraint 

The foreign key for QuestionId is linked from the Image_Question Table to the QuestionId in the Question Table.

Thanks

Remove foreign key constrain first and then drop index. Otherwise you will always get error.

alter table Image_Question drop foreign key key_name_here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM