Dropping Unique constraint from MySQL table

Ankur Mukherjee picture Ankur Mukherjee · Aug 15, 2010 · Viewed 206.6k times · Source

How can I drop the "Unique Key Constraint" on a column of a MySQL table using phpMyAdmin?

Answer

Mark Byers picture Mark Byers · Aug 15, 2010

A unique constraint is also an index.

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.

Then you can use DROP INDEX:

DROP INDEX index_name ON tbl_name

or the ALTER TABLE syntax:

ALTER TABLE tbl_name DROP INDEX index_name