If you ever executed the following command in mysql:
alter table table drop column;
and got the following error:
1025 – Error on rename of ‘.\\#sql-880_3c’ to ‘.\\ ’ (errno: 150),
Don’t panic.
It’s probably because you’re trying to drop a column that’s a foreign key. Execute this command: SHOW ENGINE INNODB STATUS to debug more. A large text is dumped on the console and if you read carefully, you’re likely to have something similar to: “LATEST FOREIGN KEY ERROR…” The solution is to drop foreign key and any corresponding index before dropping the column.
Here are the steps that you must do
ALTER TABLE <table> DROP FOREIGN KEY <fk>; ALTER TABLE <table> DROP INDEX <idx>; ALTER TABLE <table> DROP COLUMN <column>;
Post a Comment