Reputation: 1497
I have assigned unique key in two field username and email. I have execute this query.
ALTER TABLE goipmonl_users DROP INDEX username;
DROP INDEX username ON goipmonl_users
It's show an error. So how can I remove unique key from selected field.
#1091 - Can't DROP 'username'; check that column/key exists.
I have username, email columns in my table.
Upvotes: 2
Views: 13375
Reputation: 4357
Please find the screen shot to delete unique index from table using phpMyAdmin
1- Select the desired database,
2-then select the desired table,
3-click on the Structure tab, select the "Relation View" option at the top of the table,
4- and finally the Indexes option at the bottom of the page.
Upvotes: 7
Reputation: 5
Well you can simply do something like this:
```
ALTER TABLE goipmonl_users DROP INDEX goipmonl_users_username_unique;
```
That is you prefix the table name with an underscore followed by the table colunm name to which the constraint is on followed again by underscore finally the index/constraint name which is UNIQUE
hope it will helps someone else that might bump into this issue again
Upvotes: 0
Reputation: 126
You can make use of the below command to find out the list of indexes of your table. From that, get the name of your unique index.
SHOW INDEX FROM tbl_name
Then use the below one to drop that index
ALTER TABLE tbl_name DROP INDEX unique_constraint_name;
Upvotes: 2
Reputation: 1
ALTER TABLE [table name] DROP INDEX [unique key constraint name];
Please double check your unique key constraint name, use this command to check:
select distinct CONSTRAINT_NAME
from information_schema.TABLE_CONSTRAINTS
where table_name = [tablename] and constraint_type = 'UNIQUE';
Upvotes: 0