#1025-在mysql中重命名(errno:150)时出错 [英] #1025 - Error on rename (errno: 150) in mysql

查看:304
本文介绍了#1025-在mysql中重命名(errno:150)时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将一个外键(id)放在一个表(misc)中,该表是表(main)中的主键(id).数据库名称(xxx)

I am trying to drop a foreign key(id) in one table(misc) which is the primary key(id) in table(main). db name(xxx)

alter table misc drop FOREIGN KEY id

我收到此错误

#1025-将'.\ interview#sql-edc_27'重命名为'.\ interview \ misc'(错误:150)时出错

#1025 - Error on rename of '.\interview#sql-edc_27' to '.\interview\misc' (errno: 150)

推荐答案

SHOW CREATE TABLE misc ;

您不能使用列名删除外键,运行上面的查询以找出正确的名称,例如misc_ibfk_1

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

嘿,这是这个名字:

alter table misc drop FOREIGN KEY  misc_ibfk_1

这篇关于#1025-在mysql中重命名(errno:150)时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆