Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MySql views and modifies auto_increment handouts

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report