【MySQL】自增步长调整
查看配置
show variables like '%increment%';
如果:
auto_increment_increment=2
执行:
set @@global.auto_increment_increment = 1;
set @@auto_increment_increment =1;
如果:
auto_increment_offset=2
执行:
set @@global.auto_increment_offset =1;
set @@auto_increment_offset =1;
————————————————
版权声明:本文为CSDN博主「qq_33508876」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_33508876/article/details/79725543
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)
【MySQL】自增步长调整的更多相关文章
- mysql 的增删改查
数据库的基本流程就是先看你的数据库中的库都是哪些:show databases; 然后再进入相应的库进行操作 : use+进入的库/表 切换路径 查看这个库内的所有的表: show tabales ...
- (转)mysql自增列导致主键重复问题分析
mysql自增列导致主键重复问题分析... 原文:http://www.cnblogs.com/cchust/p/3914935.html 前几天开发童鞋反馈一个利用load data infile ...
- MySQL自增属性auto_increment_increment和auto_increment_offset
MySQL的系统变量或会话变量auto_increment_increment(自增步长)和auto_increment_offset(自增偏移量)控制着数据表的自增列ID. mysql> sh ...
- MySQL之增删改查之
MySQL之增删改查 前言:以下是MySQL最基本的增删改查语句,很多IT工作者都必须要会的命令,也是IT行业面试最常考的知识点,由于是入门级基础命令,所有所有操作都建立在单表上,未涉及多表操作. ...
- MySQL AutoIncrement--自增锁模式
自增锁模式 在MYSQL 5.1.22版本前,自增列使用AUTO_INC Locking方式来实现,即采用一种特殊的表锁机制来保证并发插入下自增操作依然是串行操作,为提高插入效率,该锁会在插入语句完成 ...
- MySql之增删改查 · YbWork's Studio
前提:在进行"增删改查"的操作之前,先建立一个包含数据表student的数据库(具体操作可以见MySQL之最基本命令): 1."增"--添加数据 1.1 为表中 ...
- MySQL自增ID 起始值 修改方法
在mysql中很多朋友都认为字段为AUTO_INCREMENT类型自增ID值是无法修改,其实这样理解是错误的,下面介绍mysql自增ID的起始值修改与设置方法. 通常的设置自增字段的方法: 创建表格时 ...
- Java连接MySQL数据库增删改查通用方法
版权声明:本文为博主原创文章,未经博主允许不得转载. Java连接MySQL数据库增删改查通用方法 运行环境:eclipse+MySQL 以前我们Java连接MySQL数据库都是一个数据库写一个类,类 ...
- node.js中对 mysql 进行增删改查等操作和async,await处理
要对mysql进行操作,我们需要安装一个mysql的库. 一.安装mysql库 npm install mysql --save 二.对mysql进行简单查询操作 const mysql = requ ...
随机推荐
- Nginx 环境搭建 (windows)
Nginx 环境搭建 (windows) 资源 # nginx在线文档和支持 For online documentation and support please refer to nginx.or ...
- 数据库的查——select的基本使用
--创建学生表 create table students ( id int unsigned not null auto_increment primary key, name varchar(20 ...
- [LeetCode] 789. Escape The Ghosts 逃离鬼魂
You are playing a simplified Pacman game. You start at the point (0, 0), and your destination is (ta ...
- [LeetCode] 780. Reaching Points 到达指定点
A move consists of taking a point (x, y) and transforming it to either (x, x+y) or (x+y, y). Given a ...
- [LeetCode] 16. 3Sum Closest 最近三数之和
Given an array nums of n integers and an integer target, find three integers in nums such that the s ...
- Gogs配置(本地安装篇-Debian)
知识储备: 用过MySQL等 了解Linux最基本的操作 git常用操作 关于ssh 本文参考:linux上安装gogs搭建个人仓库 下载 https://github.com/gogs/gogs/r ...
- MongoDB出现The default storage engine 'wiredTiger' is not available之问题解决
问题描述:低版本MongoDB存在该问题(版本为3.x),高版本则无该问题. 参考解决问题链接:MongoDB学习—(1)安装时出现The default storage engine ‘wiredT ...
- 大话设计模式Python实现-装饰模式
装饰模式(Decorator Pattern):动态的给一个对象添加一些额外的职责,就增加功能来说,装饰模式比生成子类更为灵活. 下面是一个给人穿衣服的过程,使用装饰模式: #!/usr/bin/en ...
- Spring Boot 代码覆盖率测试
代码覆盖率测试是规范软件开发流程里一个必不可少的环节.一般都是在PG末尾阶段,伴随着IT自测产生. ↑以上,是自己yy出来的啊,反正我司是这样要求的.不跑覆盖率,鬼知道你在代码里夹杂了一些什么东西. ...
- scala中nothing和null的区别
1:nothing是所有类型的子类,他没有具体的实例对象,常见的应用:抛出异常.程序exit.无线循环等. 2:nothing是所有类型的子类,也是null的子类,nothing没有对象,但是可以用来 ...