欢迎光临
我们一直在努力

MySql查看及修改auto_increment讲义

下文内容主要给大家带来MySql查看及修改auto_increment讲义,这里所讲到的知识,与书籍略有不同,都是云搜网专业技术人员在与用户接触过程中,总结出来的,具有一定的经验分享价值,希望给广大读者带来帮助。

查看表当前auto_increment

表的基本数据是存放在mysql的information_schema库的tables表中,我们可以使用sql查出。

select auto_increment from information_schema.tables where table_schema='db name' and table_name='table name';

例子:查看 test_user 库的 userauto_increment

mysql> select auto_increment from information_schema.tables where table_schema='test_user' and table_name='user';
+----------------+| auto_increment |
+----------------+|           1002 |
+----------------+1 row in set (0.04 sec)

修改表auto_increment

alter table tablename auto_increment=NUMBER;

例子:修改 test_useruserauto_increment10000

mysql> alter table test_user.user auto_increment=10000;
Query OK, 0 rows affected (0.12 sec)
Records: 0  Duplicates: 0  Warnings: 0mysql> 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)

本文讲解了通过MySql查看与修改auto_increment的方法,更多相关内容请关注云搜网。

相关推荐:

如何通过php生成网页桌面的快捷方式

利用js遍历获取表格内数据的方法

如何实现php 数组元素快速去重效果

以上就是MySql查看及修改auto_increment讲义的详细内容,更多请关注云搜网其它相关文章!

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。