1. 程式人生 > >給 mysql 加索引

給 mysql 加索引

ble 多列 nbsp uniq alter primary rim 普通 fulltext

1.PRIMARY KEY(主鍵索引)
ALTER TABLE `table_name` ADD PRIMARY KEY ( `column` )
2.UNIQUE(唯一索引)
ALTER TABLE `table_name` ADD UNIQUE (`column` )
3.INDEX(普通索引)
ALTER TABLE `table_name` ADD INDEX index_name ( `column` )
4.FULLTEXT(全文索引)
ALTER TABLE `table_name` ADD FULLTEXT ( `column` )
5.多列索引(組合索引)
ALTER TABLE `table_name` ADD INDEX index_name ( `column1`, `column2`, `column3` )

給 mysql 加索引