Get the App
SLTechnology News&Howtos  ›  Database  › 

MySql views and modifies auto_increment handouts

Shulou Source: shulou.com Published: 2022-06-01 20:38:38 10月25日 Update

The following content mainly brings you MySql to view and modify auto_increment handouts, the knowledge here is slightly different from books, are summed up by professional and technical personnel in the process of contact with users, have a certain experience sharing value, hope to bring help to the majority of readers.

View table current auto_increment

The basic data of the table is stored in the tables table of mysql's information_ schema library, which we can look up using sql.

Select auto_increment from information_schema.tables where table_schema='db name' and table_name='table name'

Example: view the user table auto_increment of the test_user library

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) modify table auto_increment

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. Please follow us for more information.

Related recommendations:

How to generate shortcuts to web desktops through php

The method of obtaining data in Table by traversing js

How to realize the effect of fast deduplication of php array elements

These are the details of MySql's viewing and modifying auto_increment handouts. For more information, please pay attention to other related articles!

Tags: Content lectures examples data methods more different the following majors books people values elements that is technology effects arrays articles methods desktops Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Shulou Information Shulou Tech Info Microsoft macOS