从 MySQL 表中删除唯一约束
2021-11-20 00:00:00
mysql
如何使用 phpMyAdmin 在 MySQL 表的列上删除唯一键约束"?
How can I drop the "Unique Key Constraint" on a column of a MySQL table using phpMyAdmin?
推荐答案
唯一约束也是一个索引.
A unique constraint is also an index.
首先使用SHOW INDEX FROM tbl_name
找出索引的名称.索引的名称存储在该查询结果中名为 key_name
的列中.
First use SHOW INDEX FROM tbl_name
to find out the name of the index. The name of the index is stored in the column called key_name
in the results of that query.
然后就可以使用DROP INDEX:
DROP INDEX index_name ON tbl_name
或ALTER TABLE 语法:>
ALTER TABLE tbl_name DROP INDEX index_name
相关文章