This article will introduce how to view the auto_increment of the table and how to modify it
The basic data of the table is tables stored in the information_schema library of mysql table, we can use sql to find out.
select auto_increment from information_schema.tables where table_schema='db name' and table_name='table name';
Example: View test_user library’s user tableauto_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)
alter table tablename auto_increment=NUMBER;
Example: Modify test_user library user table auto_increment to 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)
This article explains how to view and modify auto_increment through MySql. For more related content, please pay attention to the php Chinese website.
Related recommendations:
How to generate a shortcut to the web desktop through php
Use js traversal to obtain the data in the table Method
How to achieve rapid deduplication effect of php array elements
The above is the detailed content of How to view and modify auto_increment method through MySql. For more information, please follow other related articles on the PHP Chinese website!