如何在MySQL中删除不存在的表中不存在的外键?

时间:2013-07-11 23:29:30

标签: mysql foreign-keys

我正在尝试重命名InnoDB表中的主键,并且我不断获得Errno 150. SHOW INNODB STATUS显示:

LATEST FOREIGN KEY ERROR
130711 18:22:53 Error in foreign key constraint of table xx/client_location_business_load:
there is no index in referenced table which would contain
the columns as the first columns, or the data types in the
referenced table do not match the ones in table. Constraint:
,
  CONSTRAINT "business_load_business_load_name_key" FOREIGN KEY ("name_id") REFERENCES "client_businesstype_load_name" ("name_id") ON DELETE CASCADE ON UPDATE CASCADE

client_location_business_load甚至不存在!它被重命名。名为business_load_business_load_name_key的约束也不存在,它已被删除,并且不会出现在information_schema.key_column_usage中。

有没有人知道这里发生了什么?

1 个答案:

答案 0 :(得分:0)

您必须删除数据库并以相同的排序规则重新创建它。似乎没有替代方案。