Tell me more ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I somehow tricked MySQL into believing I have a foreign key that does not exist.

I had a table with both an Id column and a Number column. I wanted to merge the two, so I cleared the few tables referring to it, then cleared and remade the foreign keys so that they pointed to Id instead of Number. But when I went to delete the Number column I was told my foreign key constraint was incorrectly formed. I double checked I had removed all foreign keys associated with that column and tried again to no avail.

I then tried renaming the table. It worked fine. After renaming it, I deleted the Number column. It worked fine. Then I tried naming the table back and was given the same message.

After that I converted the table to MYISAM, then renaming it. That also worked. Lastly, I tried converting the table back to InnoDB, which gives me the same error.

Where did this 'ghost' key come from and how do I get rid of it without dumping the entire database?

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.