MySql查看与修改auto_increment方法(转)
原文:https://blog.csdn.net/fdipzone/article/details/50421831
查看表当前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 | +----------------+ | | +----------------+ 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 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)
相关推荐
CoderToy 2020-11-16
emmm00 2020-11-17
王艺强 2020-11-17
ribavnu 2020-11-16
bianruifeng 2020-11-16
wangshuangbao 2020-11-13
苏康申 2020-11-13
vivenwan 2020-11-13
moyekongling 2020-11-13
云中舞步 2020-11-12
要啥自行车一把梭 2020-11-12
aydh 2020-11-12
kuwoyinlehe 2020-11-12
minerk 2020-11-12
vitasfly 2020-11-12
jazywoo在路上 2020-11-11
敏敏张 2020-11-11
世樹 2020-11-11