欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

【Mysql】自增步长调整

程序员文章站 2022-04-01 17:39:33
``` mysql> show variables like '%increment%'; + + + | Variable_name | Value | + + + | auto_increment_increment | 2 | | auto_increment_offset | 1 | | d... ......
mysql> show variables like '%increment%';
+-----------------------------+-------+
| variable_name               | value |
+-----------------------------+-------+
| auto_increment_increment    | 2     |
| auto_increment_offset       | 1     |
| div_precision_increment     | 4     |
| innodb_autoextend_increment | 64    |
+-----------------------------+-------+
4 rows in set (0.03 sec)

mysql> set @@global.auto_increment_increment = 1;
query ok, 0 rows affected (0.00 sec)

mysql> show variables like '%increment%';
+-----------------------------+-------+
| variable_name               | value |
+-----------------------------+-------+
| auto_increment_increment    | 2     |
| auto_increment_offset       | 1     |
| div_precision_increment     | 4     |
| innodb_autoextend_increment | 64    |
+-----------------------------+-------+
4 rows in set (0.07 sec)

mysql> set @@auto_increment_increment =1;
query ok, 0 rows affected (0.00 sec)

mysql> 
mysql> show variables like '%increment%';
+-----------------------------+-------+
| variable_name               | value |
+-----------------------------+-------+
| auto_increment_increment    | 1     |
| auto_increment_offset       | 1     |
| div_precision_increment     | 4     |
| innodb_autoextend_increment | 64    |
+-----------------------------+-------+
4 rows in set (0.04 sec)