#1025 - Error on rename of './database/#sql-2e0f_1254ba7' to './database/table' (errno: 150) #1025 - Error on rename of './database/#sql-2e0f_1254ba7' to './database/table' (errno: 150) sql sql

#1025 - Error on rename of './database/#sql-2e0f_1254ba7' to './database/table' (errno: 150)


There is probably another table with a foreign key referencing the primary key you are trying to change.

To find out which table caused the error you can run SHOW ENGINE INNODB STATUS and then look at the LATEST FOREIGN KEY ERROR section.


As was said you need to remove the FKs before. On Mysql do it like this:

ALTER TABLE `table_name` DROP FOREIGN KEY `id_name_fk`;ALTER TABLE `table_name` DROP INDEX `id_name_fk`;


For those who are getting to this question via google... this error can also happen if you try to rename a field that is acting as a foreign key.