1、创建索引 (PRIMARY KEY,INDEX,UNIQUE)
mysql>ALTER TABLE tbl_name ADD INDEX index_name (column list); mysql>ALTER TABLE tbl_name ADD UNIQUE index_name (column list); mysql>ALTER TABLE tbl_name ADD PRIMARY KEY index_name (column list);
2、删除索引(PRIMARY KEY,INDEX,UNIQUE)
mysql>ALTER TABLE tbl_name DROP INDEX index_name (column list); mysql>ALTER TABLE tbl_name DROP UNIQUE index_name (column list); mysql>ALTER TABLE tbl_name DROP PRIMARY KEY index_name (column list);
3、重建索引
mysql> REPAIR TABLE tbl_name QUICK;
4、查看某个数据表的索引
mysql> SHOW INDEX FROM tbl_name;