id=1 name=...id=2 id=6After deleting the records with IDs 3, 4, and 5 inserted before, why is it not 3, but to 6
You will know why if you use the command.
show create table test2;
The self-increasing value will not be reduced when you delete the record.
test2 | CREATE TABLE `test2` ( `id` int(11) NOT NULL AUTO_INCREMENT, `mouth` int(11) NOT NULL, `num` int(11) NOT NULL, PRIMARY KEY (`id`,`mouth`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=gbk
If you want to modify the self-increment value, please use sql to modify it
alter table test2 auto_increment=4;
The modified primary key auto-increment starting point.
test2 | CREATE TABLE `test2` ( `id` int(11) NOT NULL AUTO_INCREMENT, `mouth` int(11) NOT NULL, `num` int(11) NOT NULL, PRIMARY KEY (`id`,`mouth`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=gbk |
You can refer to mysql auto-increment here, if you want that id 继续从3开始就要手动 INSERT INTO (id,字段2,字段2) VALUES ('3',值1,值2)
id
INSERT INTO (id,字段2,字段2) VALUES ('3',值1,值2)
You will know why if you use the command.
The self-increasing value will not be reduced when you delete the record.
If you want to modify the self-increment value, please use sql to modify it
The modified primary key auto-increment starting point.
You can refer to mysql auto-increment here, if you want that
id
继续从3开始就要手动INSERT INTO (id,字段2,字段2) VALUES ('3',值1,值2)