mysql表中已有数据,为表新增一个自增id。时间:2023-03-09 03:45:59 第一步,在navicat中,例如表test新建查询,输入以下两行代码即可搞定。 alter table test add id int; alter table `test` change id id int not null auto_increment primary key; 第二步,右键test表,设计,将id移动至第一行就可。