How can I drop the "Unique Key Constraint" on a column of a MYSQL table using "Phpmyadmin".
Thanks in advance
How can I drop the "Unique Key Constraint" on a column of a MYSQL table using "Phpmyadmin".
Thanks in advance
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
The indexes capable of placing a unique key constraint on a table are PRIMARY
and UNIQUE
indexes.
To remove the unique key constraint on a column but keep the index, you could remove and recreate the index with type INDEX
.
Note that it is a good idea for all tables to have an index marked PRIMARY
.
You can DROP
a unique constraint from a table using phpMyAdmin as requested as shown in the table below. A unique constraint has been placed on the Wingspan field. The name of the constraint is the same as the field name, in this instance.