How to reset Auto Increment to a specific value in MySQL?

Once a column is set to Auto Increment the value would Increment by one for every record added. Therefore, the column value for each record would be unique and hence it could be set as a primary key. There may be times when you would want it to Increment from a specific value. This is how it can be done-

ALTER TABLE table_name AUTO_INCREMENT=1001;

 

In the above example, Auto Increment would begin from 1001 rather than 0.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s