Header Ads

Breaking News
recent

How to delete index in MySql

How to delete index in MySql, first you need to know the exact name of the INDEX (Unique key in this case) to delete or update it. INDEX names are usually same as column names. In case of more than one INDEX applied on a column, MySQL automatically suffixes numbering to the column names to create unique INDEX names.

For example if 2 indexes are applied on a column named customer_id

  1. The first index will be named as customer_id itself.

  2. The second index will be names as customer_id_2 and so on.


To know the name of the index you want to delete or update


SHOW INDEX FROM <table_name>

To delete an index


ALTER TABLE <table_name> DROP INDEX <index_name>;

Thank u.  :lol:

Ref : stackoverflow

 

No comments:

Powered by Blogger.