1、mysql自增步长不是1的解决办法
查看配置:
show variables like ‘%increment%’;
如果:
auto_increment_increment=2
执行:
set @@global.auto_increment_increment = 1;
set @@auto_increment_increment =1;
如果:
auto_increment_offset=2
执行:
set @@global.auto_increment_offset =1;
set @@auto_increment_offset =1;
2、mysql自增id乱了重新排序的解决办法
表名: user
- 删除原有主键:
alter table user drop id;
- 添加