MySQL Drop Index

Profile picture for user arilio666

We may have assigned some indexes to a table, and sometimes there is a need to remove those latched indexes from the table. DROP INDEX is explicitly used for that.

Syntax

ALTER TABLE table_name
DROP INDEX index_name;

Example

  • Now we have a table called "rec" and want to remove the unique index assigned to it.
  • Let us use this query to do this.

mysql drop index

Here is the index of the rec table.

ALTER TABLE rec
DROP INDEX unique_email;
  • The unique index assigned to the email has been removed. Let us check it out.
SHOW INDEXES FROM rec;  

drop index in mysql

  • We can see here that the mentioned index has been removed.
Tags