网站首页Mysql
mysql 索引创建,删除,重建,查看
发布时间:2018-04-21编辑:Cary
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;
关键字词:mysql 索引创建,删除,重建,查看
下一篇: linux 命令大全