本文将介绍如何查看表的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 库的 user 表 auto_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_user 库 user 表 auto_increment为 10000
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的方法的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1039288.html
微信扫一扫
支付宝扫一扫