Home > Database > Mysql Tutorial > body text

How to modify index in mysql

青灯夜游
Release: 2021-12-01 17:55:29
Original
26653 people have browsed it

Mysql method to modify the index: 1. Use the "DROP INDEX index name ON table name" statement to delete the original index; 2. Use "ALTER TABLE table name ADD INDEX index name [index type] (column name,... )" statement can create an index with the same name as needed.

How to modify index in mysql

The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.

In mysql, the index cannot be modified directly. You can modify the index by deleting the original index and then creating an index with the same name as needed.

1. Delete the original index

When the index is no longer needed, you can use the DROP INDEX statement to delete the index.

Grammar format:

DROP INDEX <索引名> ON <表名>
Copy after login

The syntax description is as follows: