About MySQL self-growth ID set the initial value

Source: Internet
Author: User

In the MySQL database, set the ID for the self-growth type, but because the program is still in the development phase, it is easy to produce error data, and then directly deleted, but the ID of the self-growth value is not reduced, here is the hint:

If the data in the table is not used, the data is deleted directly, and the autogrow ID will not start at 1.

So what do we need to do? There are two ways to do this:

1. ALTER TABLE ' tablename ' auto_increment= ' 22723 '; execution succeeded, continue inserting is starting from 22723:)

2. You can use the "empty data sheet". This way, the auto-Grow ID will start at 1.

About MySQL self-growth ID set the initial value

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.