How to reset AUTO Increment in MySQL




Asked on November 29, 2014
Hi, How can I reset AUTO Increment in MySQL database.
In my database, auto increment is incremented like 2000, 2001 where as max  element is 500.
How to fix it safely?



Replied on November 29, 2014
Suppose you have a table A, and you need to reset the Auto Increment, run the query as below.

ALTER TABLE A AUTO_INCREMENT=500

I would suggest that take the backup of database before running the query.


Write Answer










©2024 concretepage.com | Privacy Policy | Contact Us