Error on rename of '...' to './db/table' (errno: 150)

Чтобы увидеть детали это ошибки нужно выполнить в консоли mysql :

mysql> SHOW ENGINE INNODB STATUS;

потом кроме разной информации можно найти что-то типо этого :
------------------------
LATEST FOREIGN KEY ERROR
------------------------
160623 17:32:46 Error in dropping of a foreign key constraint of table "bs"."partners",
in SQL command
ALTER TABLE `partners` DROP FOREIGN KEY `hall_id`
Cannot find a constraint with the given id "hall_id".

пишет что не видит fk , ищем:

mysql> select TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME from INFORMATION_SCHEMA.KEY_COLUMN_USAGE where REFERENCED_TABLE_SCHEMA = 'bs' AND REFERENCED_TABLE_NAME = 'hall';
+------------+-------------+-----------------+-----------------------+------------------------+
| TABLE_NAME | COLUMN_NAME | CONSTRAINT_NAME | REFERENCED_TABLE_NAME | REFERENCED_COLUMN_NAME |
+------------+-------------+-----------------+-----------------------+------------------------+
| partners | hall_id | partners_ibfk_3 | hall | id |
+------------+-------------+-----------------+-----------------------+------------------------+

находим и удаляем:

mysql> ALTER TABLE `partners` DROP FOREIGN KEY `partners_ibfk_3`;
Query OK, 1 row affected (0.04 sec)
Records: 1 Duplicates: 0 Warnings: 0

и после этого выполняем первую команду которая выпадала по ошибке :

mysql> ALTER TABLE `partners` DROP `hall_id`;
Query OK, 1 row affected (0.05 sec)
Records: 1 Duplicates: 0 Warnings: 0

Комментарии

Аватар пользователя DavidPrusa

Hi everyone,
Do you guys know something about this store UsDrugsStore?

Give me your reviews on Cialis or Provera How does it work on you?

I wrote to customers support and they sent me a certificate that proofs that all the products are original quality, but first I wanna read some real reviews