1.去除原id的自增功能:ALTER TABLE A_A MODIFY COLUMN id int(10) NOT NULL FIRST ;
2.添加名称为cstId,类型为bigint的字段:alter table A_A add cstId integer(100) NOT NULL;
3.设置cstId为建 保证唯一性:alter table A_A add index(cstId);
4.将字段cstId 设置为自增:alter table A_A modify cstId bigint auto_increment ;
1.去除添加字段cstId的自增:ALTER TABLE A_A MODIFY COLUMN cstId bigint(20) NOT NULL FIRST ;
2.恢复原有id字段的自增:alter table A_A modify id bigint auto_increment ;
3.删除添加的字段cstId:ALTER TABLE A_A drop COLUMN cstId;
mysql 建表后 重新构建 自增字段 (保留 原有字段结构)
原文:https://www.cnblogs.com/nqtt/p/14179285.html