I have MySQL 5.5.37 running on my development machine. I use innodb tables. The following problem was encountered - auto-increment is reset after the server is restarted.
Found autoinc_lock_mode , set to 0, but did not help.
TeamSHOW VARIABLES shows a value of 0 for autoinc_lock_mode.
What am I doing:
select max(id) from tablex; // 11, autoincrement is 12
insert into tablex values ('foo');
select max(id) from tablex; // 12, autoincrement is 13
delete from tablex where id > 11; // autoincrement is 13
Then I restart the server ... and .... (drum roll)
show create table tablex; // autoincrement 12 instead of 13
WHAT TO DO WRONG ?: (
// UPD
I need to use the MyISAM table. Thank you all for your answers / comments.
source
share