简体   繁体   English

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

[英]How do I delete a foreign key that does not exist from a table that does not exist, in MySQL?

I'm trying to rename a primary key in an InnoDB table and I kept getting an Errno 150. SHOW INNODB STATUS shows: 我试图重命名InnoDB表中的主键,但我一直得到Errno150。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

The table client_location_business_load does not even exist! client_location_business_load甚至不存在! It was renamed. 它被重命名。 The constraint named business_load_business_load_name_key does not exist either, it was dropped and it does not appear in information_schema.key_column_usage . 名为business_load_business_load_name_key的约束也不存在,已被删除并且它也没有出现在information_schema.key_column_usage

Does anyone have a clue about what's going on here? 有人知道这里发生了什么吗?

You have to drop the database and recreate it in the same collation. 您必须删除数据库并以相同的排序规则重新创建它。 There does not seem to be an alternative. 似乎没有其他选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM