以下内容部分摘录自:http://blog.csdn.net/wyswlp/article/details/8881103
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` )  

6.修改字段类型

ALTER TABLE `表名` CHANGE `字段名` `字段名` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL;

7.删除字段

ALTER TABLE table_name DROP field_name;   

Related Posts: MySQL 常用ALTER指令整理 :

avatar