mysql表字段添加主键: alter table user add primary key(id); alter table user change id id int(10) not null auto_increment; mysql删除表字段主键: alter table user change id id int(10); //先删除自增长 alter table user drop primary key; //再删除主键