MySQL says “#1025 - Error on rename of” but means …

mysql_100x52-64.gifMySQL told me that it had a problem renaming a file. So I really thought I would go and help it by removing the file on the command line. But somehow I really felt that it didn’t really mean to rename a file. So I did a bit of googling and in the mysql bug tracker I found the problem.
The real problem occurs when you are using foreign key constraints with InnoDB. Even though I had only created an additional unique index on one of two columns where one of them was a foreign key. And when I tried to remove it mysql told me it had problems renaming a file :-(.
The solution was to remove the foreign key using ALTER TABLE tablename DROP FOREIGN KEY fkname. Now I was able to remove my index and then I added the foreign key constraint again.
Really ugly.

7 Comments »

  1. Eichi said,

    February 13, 2010 at 2:44 pm

    Thank you for that info! It really helped me out solving the same problem!

  2. calebhc said,

    April 30, 2010 at 9:20 am

    Wow, thanks a lot! I was beginning to worry why I couldn’t drop some indexes but now everything is ok! :) Thanks again

  3. ivan.bisevac said,

    September 4, 2010 at 3:48 pm

    Thanks a lot, i had same problem an this solved it.

  4. pokaru said,

    April 18, 2011 at 10:19 pm

    Is there a way to dynamically look up a fk name? I’m writing a script that will update a few columns which are fk’s. How can I dynamically find out the fk to drop?

  5. Roshan said,

    June 10, 2011 at 11:59 am

    thanks…it really helped me solving similar problem

  6. Tim Wicks said,

    June 28, 2011 at 11:50 pm

    I am working on building a blog like Pythoneer » MySQL says “#1025 - Error on rename of” but means …. I still have a way to go, and surely do not yet have the visitors you appear to get. if you can, please give me some comments on http://best-kindle.info/the-new-york-times-for-a-dollar-a-day/ as I know it needs a tune up. Nice website, sincerely, Tim Wicks

  7. Khemistry said,

    August 1, 2011 at 2:46 pm

    Thanks for sharing, that helped a lot!!!

RSS feed for comments on this post · TrackBack URL

Leave a Comment