すると、 次のようなエラーが。 [ HY000] [ 1025] Error on rename of '. / mydb/ # sql- 7dda_ a5' to '. In that case you would have to drop the foreign key, and then do the alter table and drop the column. you can' t drop the foreign key using the column name, but instead you would have to find the name used to index it. You can' t drop the foreign key using the column name, run the above query to find out the correct name, something like misc_ ibfk_ 1. This statement resolved the issue ( # 1025, errno: 150), but the index remained in the table. Error on rename of. errno: 150 - Foreign key constraint is incorrectly formed). allow you to temporarily delete a row in the currency table or add an invalid currencyId in the foreign key tables, but not to drop the primary key. However, I have been able to find circumstances to reproduce the error, namely when executing the DROP FOREIGN KEY on the same foreign. He mentions that the index key ( KEY) prevents the foreign key from dropping. DROP INDEX時に予め, まあ個人的な備忘録です。. ALTER TABLE 対象テーブル名 DROP INDEX ` インデックス名`. は何時間もかかる) が終わって、 それをリネームする 段階になって初めてエラーが出てくるんじゃなくて。 ラベル: MySQL.
To find out which table caused the error you can run SHOW ENGINE INNODB STATUS and then look at the LATEST FOREIGN KEY ERROR. ALTER TABLE ` table_ name` DROP FOREIGN KEY ` id_ name_ fk` ; ALTER TABLE ` table_ name` DROP INDEX ` id_ name_ fk` ;. To bypass this in PHPMyAdmin or with MySQL, first remove the foreign key constraint before renaming the attribute. For example I had a unique index involving two separate foreign key columns. I had to drop the foreign keys in question before I could drop the unique index. ( And obviously you can add the foreign keys back afterward. DROP INDEX は、 テーブル tbl_ name から index_ name という名前のインデックスを 削除します。 このステートメントは、 この. これらのキーワードを標準の MySQL Server 5. 6 リリースで使用しようとすると、 構文エラーが発生します。 ONLINE および OFFLINE.