需求描述:
今天在做SQL的優化的時候,想要把mysql中某個表上的索引刪除掉,突然忘記語法了,找到幫助,在此記錄下
操作過程:
1.查看表上的索引
show index from ti_o_sms;

備注:通過以上的查詢,TI_O_SMS_IDX是一個復合索引.
2.刪除這個復合索引
drop index TI_O_SMS_idx on ti_o_sms;

備注:執行完刪除語句之后,再次查詢,表上的復合索引已經被刪除了.
3.通過help命令查看刪除索引的語法
mysql> help drop index Name: 'DROP INDEX' Description: Syntax: DROP INDEX index_name ON tbl_name [algorithm_option | lock_option] ... algorithm_option: ALGORITHM [=] {DEFAULT|INPLACE|COPY} lock_option: LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE} DROP INDEX drops the index named index_name from the table tbl_name. This statement is mapped to an ALTER TABLE statement to drop the index. See [HELP ALTER TABLE]. To drop a primary key, the index name is always PRIMARY, which must be specified as a quoted identifier because PRIMARY is a reserved word: DROP INDEX `PRIMARY` ON t; URL: http://dev.mysql.com/doc/refman/5.7/en/drop-index.html mysql>
文檔創建時間:2018年8月16日10:13:22
