1_1.添加PRIMARY KEY(主键索引)
mysql>ALTER TABLE `table_name` ADD PRIMARY KEY ( `column` )
1_2.添加UNIQUE(唯一索引)
mysql>ALTER TABLE `table_name` ADD UNIQUE ( `column` )
1_3.添加INDEX(普通索引)
mysql>ALTER TABLE `table_name` ADD INDEX your_index_name ( `column` )
1_4.添加FULLTEXT(全文索引)
mysql>ALTER TABLE `table_name` ADD FULLTEXT ( `column`)
1_5.添加多列索引
mysql>ALTER TABLE `table_name` ADD INDEX your_index_name ( `column1`, `column2`, `column3` )
2_1.删除索引
mysql>drop index your_index_name on table_name ;
时间: 2024-10-25 02:48:07