如下,通过alter修改表结构使id列自增的时候报出错误:ERROR 1075 (42000):
alter table user2 add id int not null auto_increment first;
ERROR 1075 (42000):
原因:Mysql在定义自增列的时候需要指定表的主键,进行如下修改:
alter table user2 add id int not null auto_increment first,add primary key(id);
Query OK, 0 rows affected (0.20 sec)