Search code examples
mysqlmysql-error-1025

Can anyone explain this MySQL error?


ERROR 1025 (HY000): Error on rename of '.\forumf\#sql-1718_20' to '.\forumf\posts' (errno: 150)
  1. Is the error number 1025 or 150?
  2. I was deleting a primary key (which I had set by mistake) which was also a foreign key at the time.
  3. What is HY000?

I got this quite cryptic error message while editing keys on a MySQL table. Can someone explain the error, it's cause and it's fix?


Solution

  • Yeah, you hit a foreign key constraint.

    A show innodb status; will show the cause of the problem.

    A quick fix is to drop the constraint, do what you're doing, and then recreate the constraint.