开发者社区 问答 正文

技术运维问题 - MYSQL使用 -RDS MySQL auto_increment 自增字段相关参数



RDS MySQL 经常会使用到 auto_increment 自增长字段,下面是相关参数的说明。
#参数名称默认值最大值作用
1auto_increment_increment165535控制增量的幅度
2auto_increment_offset165535增量开始的位置(开始的偏移量)

注:
  • 两个参数均可以在全局和会话级别设置。
  • 如果 auto_increment_offset 的值大于 auto_increment_increment,则 auto_increment_offset 被忽略。

例子:

Create table au ( id int auto_increment primary key);

1. 插入奇数



# 查看当前会话 auto_increment 相关参数设置 show variables like 'auto_i%';# 插入 4 行数据 insert into au values ( null),( null),( null),( null);# 检查 au 表内数据 select * from au;
[/url]

如问题还未解决,请联系[url=https://selfservice.console.aliyun.com/ticket/createIndex.htm?spm=5176.775974787.2.7.O718D0]售后技术支持

展开
收起
梨好橙 2018-09-22 23:53:50 1645 分享 版权
0 条回答
写回答
取消 提交回答