我在mysql中try 过:
mysql> alter table region drop column country_id;
得到这个:
ERROR 1025 (HY000): Error on rename of './product/#sql-14ae_81' to
'./product/region' (errno: 150)
有什么 idea 吗?外键的东西?
我在mysql中try 过:
mysql> alter table region drop column country_id;
得到这个:
ERROR 1025 (HY000): Error on rename of './product/#sql-14ae_81' to
'./product/region' (errno: 150)
有什么 idea 吗?外键的东西?
如果表使用InnoDB引擎,通常会出现此错误.在这种情况下,必须删除外键,然后执行alter table并删除列.
但棘手的是,不能使用列名删除外键,而是必须找到用于索引它的名称.要找到该选项,请执行以下 Select :
显示创建表区域;
这应该会显示索引的名称,如下所示:
限制
region_ibfk_1
foreign
现在只需发布一个:
alter table region drop外键
最后是一个:
alter table region drop列
你可以走了!