MySQL索引操作
- 创建索引
- 通过create创建
CREATE [UNIQUE|FULLTEXT|SPATIAL] INDEX index_name [USING index_type] ON table_name(column,...)
例如 : CREATE INDEX user_name_index ON user (name);
- 通过alert 表添加
ALTER TABLE table_name ADD [UNIQUE|FULLTEXT|SPATIAL] INDEX index_name (column,...) [USING index_type]
- 删除索引
ALTER TABLE table_name DROP INDEX index_name;
3. 查询索引
- ```
SHOW INDEX FROM table_name [FROM db_name]
SHOW INDEX FROM [db_name.]table_name