可以修改系统变量 auto_increment_increment
查看步长信息
mysql> SHOW VARIABLES LIKE 'auto_inc%';
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| auto_increment_increment | 1 |
| auto_increment_offset | 1 |
+--------------------------+-------+
2 rows in set (0.01 sec)
修改步长信息
mysql> SET @@auto_increment_increment=10; //设置步长
Query OK, 0 rows affected (0.00 sec)
mysql> SET @@auto_increment_offset=10000; //设置步长
Query OK, 0 rows affected (0.00 sec)
mysql> SHOW VARIABLES LIKE 'auto_inc%';
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| auto_increment_increment | 10 |
| auto_increment_offset | 10000 |
+--------------------------+-------+
2 rows in set (0.01 sec)
修改 my.conf
vi /etc/my.cnf
auto_increment_increment=10;
auto_increment_offset =10000;
重启mysql即可