检察表当前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的要领,更多相干内容请关注ki4网。
相干引荐:
怎样经由过程php生成网页桌面的快捷方式
应用js遍历猎取表格内数据的要领
怎样完成php 数组元素快速去重结果
以上就是怎样经由过程MySql检察与修正auto_increment的要领的细致内容,更多请关注ki4网别的相干文章!