Showing posts with label Drop Unique Key Constraint from table in MySQL. Show all posts
Showing posts with label Drop Unique Key Constraint from table in MySQL. Show all posts

Tuesday 6 October 2015

How to remove unique key from mysql table


How to remove unique key from mysql table

Use below query :

ALTER TABLE `table_name` DROP INDEX key_name;

If you don't know the key_name then first try below query, you can get key_name.

SHOW CREATE TABLE table_name

OR

SHOW INDEX FROM table_name;

If you want to remove/drop primary key from mysql table, Use below query for that

ALTER TABLE `products` DROP INDEX `PRIMARY`;