本文将介绍如何查看表的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
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: 0
1 row in set (0.04 sec)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)