liu-ke

在实际测试工作过程中,有时因为生产环境已有历史数据原因,需要测试环境数据id从某个值开始递增,此时,我们需要修改数据库中自增ID起始值,下面以MySQL为例:

表名:users;

建表时添加:

create table users(id int auto_increment primary key,666);

表已创建,修改:

alter table users add id int auto_increment primary key;  #将自增字段设置为primary key
alter table users AUTO_INCREMENT=10000;

 

分类:

技术点:

相关文章:

  • 2021-09-25
  • 2021-10-20
  • 2021-10-20
  • 2021-10-20
  • 2021-10-06
  • 2021-11-23
  • 2021-10-30
  • 2021-10-20
猜你喜欢
  • 2021-10-20
  • 2021-10-20
  • 2021-10-20
  • 2021-10-20
  • 2021-10-20
  • 2021-10-20
  • 2021-10-20
相关资源
相似解决方案