天天看点

MySQL的auto_increment功能

1、相关的参数:

show VARIABLES like '%auto_increment%';

auto_increment_increment

auto_increment_offset

可以通过set语句进行修改,但是重启服务器之后会重新变为1

SET auto_increment_increment=2;   

SET auto_increment_offset=5; 

2、在MyISAM和Innodb两种存储引擎下二者的不同:

重启服务器之后,Innodb类型系统会维护种子序列的最大值为当前数据的最大值,而MyISAM则保持与重启前一致。