本文介绍了MySQL 无法删除外键约束中所需的索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!
问题描述
我需要更改我现有的数据库以添加一列.因此,我还想更新 UNIQUE 字段以包含该新列.我正在尝试删除当前索引,但不断收到错误 MySQL 无法删除外键约束中所需的索引
I need to ALTER my existing database to add a column. Consequently I also want to update the UNIQUE field to encompass that new column. I'm trying to remove the current index but keep getting the error MySQL Cannot drop index needed in a foreign key constraint
推荐答案
您必须删除外键.MySQL 中的外键自动在表上创建索引(有一个 SO Question 主题).
You have to drop the foreign key. Foreign keys in MySQL automatically create an index on the table (There was a SO Question on the topic).
这篇关于MySQL 无法删除外键约束中所需的索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!