Error on rename of mysql

error on rename of mysql

Try running "mysql_upgrade" (after backing up your database). This happened to me when I changed my database server from MySQL to Mariadb (the. bugs.mysql.com › bug. You usually get this error if your tables use the InnoDB engine. In that case you would have to drop the foreign key, and then do the alter table and drop the.

Error on rename of mysql - happens

Help With Error 1025 Hy000 Error On Rename Of Errno 150

Help with: ERROR 1025 (HY000): Error on rename of .... (errno: 150)

Tags: mysql Answers: 1 +-------+----------------------------------------------+ the path is also wrong.

Description: When I want to drop a column that contains foreign keys then I get a weird error message. Example: DROP TABLE IF EXISTS users; DROP TABLE IF EXISTS countries; CREATE TABLE countries ( id INT NOT NULL AUTO_INCREMENT, country_name VARCHAR(200), PRIMARY KEY (id) ); CREATE TABLE users ( id INT NOT NULL AUTO_INCREMENT, name VARCHAR(200), country_id INT, PRIMARY KEY (id) ); ALTER TABLE users ADD CONSTRAINT dummy FOREIGN KEY (country_id) REFERENCES countries (id); ALTER TABLE users DROP COLUMN country_id; Then I get: ERROR 1025 (HY000): Error on rename of './blah/#sql-3941_618' to './blah/users' (errno: 150) If I drop the FK constraint manually then I can drop the column nicely: ALTER TABLE users DROP FOREIGN KEY dummy; ALTER TABLE users DROP COLUMN country_id; How to repeat: Execute the commands from the Description field. Suggested fix: Instead of this error message, I want the FK constraint to be dropped automatically. Or, at least a reasonable error message would be nice.
CREATETABLE`order_history`(`order_id` bigint(20)NOTNULL,`user_id` bigint(20)NOTNULL,`status_id` bigint(20)NOTNULL,`informed` tinyint(1)DEFAULT'0',`comment` text,`created_at` datetime NOTNULL,`created_by` bigint(20)NOTNULLDEFAULT'1',PRIMARYKEY(`id`),KEY`order_id_idx`(`order_id`),KEY`user_id_idx`(`user_id`),KEY`status_id_idx`(`status_id`),KEY`created_by_idx`(`created_by`), CONSTRAINT `order_history_created_by_sf_guard_user_id`FOREIGNKEY(`created_by`)REFERENCES`sf_guard_user`(`id`)ONDELETE CASCADE, CONSTRAINT `order_history_order_id_order_info_id`FOREIGNKEY(`order_id`)REFERENCES`order_info`(`id`), CONSTRAINT `order_history_status_id_order_status_id`FOREIGNKEY(`status_id`)REFERENCES`order_status`(`id`), CONSTRAINT `order_history_user_id_sf_guard_user_id`FOREIGNKEY(`user_id`)REFERENCES`sf_guard_user`(`id`)) ENGINE=InnoDB AUTO_INCREMENT=28305DEFAULT CHARSET=utf8
PATH /home/ohmhong/alt_dir/test_jfg/test2.ibd /home/ohmhong/alt_dir/test_jfg/test2.ibd +-------+----------------------------------------------+ 80 CREATETABLE`order_history`(`order_id` bigint(20)NOTNULL,`user_id` bigint(20)NOTNULL,`status_id` bigint(20)NOTNULL,`informed` tinyint(1)DEFAULT'0',`comment` text,`created_at` datetime NOTNULL,`created_by` bigint(20)NOTNULLDEFAULT'1',PRIMARYKEY(`id`),KEY`order_id_idx`(`order_id`),KEY`user_id_idx`(`user_id`),KEY`status_id_idx`(`status_id`),KEY`created_by_idx`(`created_by`), CONSTRAINT `order_history_created_by_sf_guard_user_id`FOREIGNKEY(`created_by`)REFERENCES`sf_guard_user`(`id`)ONDELETE CASCADE, CONSTRAINT `order_history_order_id_order_info_id`FOREIGNKEY(`order_id`)REFERENCES`order_info`(`id`), CONSTRAINT `order_history_status_id_order_status_id`FOREIGNKEY(`status_id`)REFERENCES`order_status`(`id`), CONSTRAINT `order_history_user_id_sf_guard_user_id`FOREIGNKEY(`user_id`)REFERENCES`sf_guard_user`(`id`)) ENGINE=InnoDB AUTO_INCREMENT=28305DEFAULT CHARSET=utf8