Mysql自动增加goest 10 by 10

时间:2015-11-04 21:19:29

标签: mysql database auto-increment

我有一个 MySQL 表,其自动增量ID声明如下:

create table bases(
    idBase int primary key auto increment,
    nombreBase varchar(50) not null
)

当我插入两条记录时:

insert into bases values('Base 1');
insert into bases values('Base 2');

它应该是id 1然后是2,但它会变为1然后是11,如果我insert则第三个需要21。是否有任何特殊原因导致这种情况发生?

提前致谢!

修改!!!!

感谢所提供的答案https://golang.org/ref/spec#Appending_and_copying_slices

1 个答案:

答案 0 :(得分:1)

在我的搜索中,我找到了一些可以帮助你的东西

  1. Auto skipping numbers-question asked on SO
  2. Insert-Ignore tutorial
  3. 明确地:尝试在数据库管理器中运行

    SHOW VARIABLES LIKE 'auto_inc%';
    
相关问题