Resetting AUTO_INCREMENT value for MySQL

Keep in mind that deleting rows or even all the rows in a table won’t reset the value of AUTO_INCREMENT of a field. After deleting, if you add a new row (by INSERT off-course), the AUTO_INCREMENT value will start from the last value+1 of the last record. To fully reset the value you need to truncate table.
To start AUTO_INCREMENT from a specific value use:
ALTER TABLE some_table AUTO_INCREMENT=10;
For more see: this link.

Leave a comment