Delete method: 1. Use the alter table statement to delete, the syntax is "alter table data table name drop index the index name to be deleted;"; 2. Use the drop index statement to delete, the syntax is "drop index to delete The index name on the data table name;".
The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.
Method 1: ALTER TABLE statement
alter table 数据表名 drop index 删除的索引名;
According to the syntax of the ALTER TABLE statement, this statement can also be used Delete index. The specific method of use is to specify part of the syntax of the ALTER TABLE statement as one of the following clauses.
DROP PRIMARY KEY: Indicates deleting the primary key in the table. A table has only one primary key, and the primary key is also an index.
DROP INDEX index_name: Indicates to delete the index named index_name.
DROP FOREIGN KEY fk_symbol: Indicates deleting the foreign key.
The example is as follows:
alter table news drop index title_sy;
Method 2: Use DROP INDEX statement
drop index 索引名 on 数据表名;
Examples are as follows:
drop index http_sy on news;
Recommended learning: mysql video tutorial
The above is the detailed content of How to delete unique index in mysql. For more information, please follow other related articles on the PHP Chinese website!