【问题标题】:How do I delete a foreign key that does not exist from a table that does not exist, in MySQL?如何从 MySQL 中不存在的表中删除不存在的外键?
【发布时间】:2014-09-24 07:13:49
【问题描述】:

我正在尝试重命名 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 中。

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

【问题讨论】:

标签: mysql foreign-keys


【解决方案1】:

您必须删除数据库并在相同的排序规则中重新创建它。似乎没有其他选择。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-21
    • 2023-01-10
    • 1970-01-01
    相关资源
    最近更新 更多