#1、查看现在mysql自增id的配置
show variables like '%increment%';
#2、下面步长为2的增长
+-------------------------------+-------+
| Variable_name | Value |
+-------------------------------+-------+
| auto_increment_increment | 2 |
| auto_increment_offset | 1 |
| div_precision_increment | 4 |
| innodb_autoextend_increment | 8 |
| ndb_autoincrement_prefetch_sz | 32 |
+-------------------------------+-------+
5 rows in set (0.01 sec)
#3、解决
set auto_increment_increment = 1和set @@auto_increment_increment = 1
如果想永久性的改回为1,在my.cnf or my.ini中查找这个field,然后修改,然后restart mysql.
网友评论