MySQL查询和修改auto_increment的方法
查询表名为tableName的auto_increment值:
复制代码 代码如下:
SELECT AUTO_INCREMENT FROM information_schema.tables WHERE table_schema='photos' and table_name="tableName";
table_schema='photos' ---- 为所在数据库名称,没有这个会把root中所有表格中表格名都为tableName的auto_increment 都调出来;
information_schema.tables 为固定的格式,sql进入命令终端----进入数据库中操作的内容;
修改 test_user 库 user 表 auto_increment为
mysql> alter table test_user.user auto_increment=10000;
Query OK, 0 rows affected (0.12 sec) Records: 0 Duplicates: 0 Warnings: 0
mysql> select auto_increment from information_schema.tables where table_schema='test_user' and table_name='user';
+----------------+
| auto_increment |
+----------------+
| 10000 |
+----------------+
1 row in set (0.04 sec)
修改 photos 库 tf_user 表 auto_increment为
mysql> alter table `photos`.`tf_user` auto_increment=20;
Query OK, 0 rows affected (0.00 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> select auto_increment from information_schema.tables where table_schema='photos' and table_name='tf_user';
+----------------+
| auto_increment |
+----------------+
| 20 |
+----------------+
1 row in set (0.00 sec)
也可以在表格的 操作 中 查看 修改 下一个插入数据的 AUTO_INCREMENT;---这样比较方便
http://blog.csdn.net/fdipzone/article/details/50421831
MySQL查询和修改auto_increment的方法的更多相关文章
- MySQL auto_increment介绍 以及 查询和修改auto_increment的方法
一.auto_increment使用方法 .创建table时设置auto_increment属性和初始值100 create table nonove ( id bigint unsigned not ...
- MySql查看与修改auto_increment方法(转)
add by zhj: 在创建表时,如果没有显式的指定AUTO_INCREMENT的值,那它默认是1 原文:https://blog.csdn.net/fdipzone/article/detail ...
- MySQL查询出错提示 --secure-file-priv解决方法
原文 在某台DB上准备运行一个SQL语句,就是用SELECT INTO OUTFILE把查询结果写入到文件的时候提示以下信息: The MySQL server is running with the ...
- mysql查询表里的重复数据方法:
INSERT INTO hk_test(username, passwd) VALUES ('qmf1', 'qmf1'),('qmf2', 'qmf11') delete from hk_test ...
- Java如何连接SQLServer,并实现查询、修改、删除方法
场景:A:在UI自动化时,删除数据时候,在界面UI提示“该XX已被使用,无法删除”. 这时候我们有需要做数据初始化的操作,需要把历史数据做删除,来确脚本运行的重复执行,和稳定性质. B: 在做新增操作 ...
- MySQL查看和修改字符集的方法
一.查看字符集 1.查看MYSQL数据库服务器和数据库字符集 方法一:show variables like '%character%';方法二:show variables like 'collat ...
- linux通过命令行查看MySQL编码并修改-简洁版方法
云服务器环境:CentOS 7.4 因为服务器配置较低,故使用MySQL5.5 未进行设置前 1.查看字符编码: mysql> show variables like '%character%' ...
- mysql查询记录修改时间于现在大于30分钟
(unix_timestamp(now())-`updatetime`)>1800
- mysql查询表里的重复数据方法
select username,count(*) as count from hk_test group by username having count>1;
随机推荐
- sql脚本创建用户角色权限表
/******************************************/ /* 名称:权限管理 */ /* 编写日期:2010.5.20 */ /* 开发者:dangqinghua * ...
- 华为笔试——C++的int型数字位排序
题目:int型数字位排序 题目介绍:输入int 型整数,按照从右至左的顺序,返回不含重复数字的新整数. 例: 输入: 99824270 输出: 072489 分析:乍一看很简单,但是很容易忽略int ...
- Java 通过先序中序序列生成二叉树
题目 二叉树的前序以及后续序列,以空格间隔每个元素,重构二叉树,最后输出二叉树的三种遍历方式的序列以验证. 输入: 1 2 3 4 5 6 7 8 9 10 3 2 5 4 1 7 8 6 10 9 ...
- AOP:静态代理实现方式①通过继承②通过接口
文件结构: 添加日志: package com.wangcf.manager; public class LogManager { public void add(){ System.out.prin ...
- C++:构造函数1——普通构造函数
前言:构造函数是C+中很重要的一个概念,这里对其知识进行一个简单的总结 一.构造函数的定义 1.类中的构造函数名与类名必须相同 2.构造函数没有函数的返回类值型说明符 [特别注意]: a.构造函数的返 ...
- Rsyslog的模板template详解
一. Template功能 根据用户需求指定任意格式 动态生成文件名 每个输出都使用了一些模板,包括针对文件的,针对用户消息等 备注: 旧版本:$template 新版本:template() V6之 ...
- C++ Primer Plus学习:第六章
C++入门第六章:分支语句和逻辑运算符 if语句 语法: if (test-condition) statement if else语句 if (test-condition) statement1 ...
- web移动端
h5:低版本(IE8及以下不支持H5标签,要引入html5shiv.js才能正常运行) 条件引入,只是针对PC端,移动端不存在这样的操作 <figure>:专门用来存放图片和相关介绍的 & ...
- 【leetcode】59.Spiral Matrix II
Leetcode59 Spiral Matrix II Given an integer n, generate a square matrix filled with elements from 1 ...
- 使用fabric1.14.0和fabric2.4.0
fabric1.14.0(支持Python2.5-2.7版本): from fabric.api import * env.gateway = '192.168.181.2' ...