Mysql Remove Unique Key From Mysql Table

Mysql Remove Unique Key From Mysql Table
----------------------------------------------

Once we have created unique key in a table and want to remove it when we want that table should now on include duplicate content.

So first we have to check what unique key name we have given some time its different from column name.

SHOW INDEX FROM users;

Once you run the above command you will get this output like below.

coderuck-mysql-uniquekey-1

As you can users_email_unique is the unique key name for email column.

Now we will run the following mysql command to remove it.

ALTER TABLE users DROP INDEX users_email_unique

After running above command you can see the key removed.

Before

coderuck-mysql-uniquekey-2

After

coderuck-mysql-uniquekey-3

 

 

 

Categories: Database Tags: #Mysql,

Newsletter Subcribe

Receive updates and latest news direct from our team. Simply enter your email.