7

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

user1701484
  • 233
  • 1
  • 2
  • 12
  • possible duplicate of [MySQL Cannot drop index needed in a foreign key constraint](http://stackoverflow.com/questions/8482346/mysql-cannot-drop-index-needed-in-a-foreign-key-constraint) – Kariem Apr 22 '14 at 14:19

1 Answers1

19

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
Zefiryn
  • 2,240
  • 2
  • 20
  • 30