MySQL: Reset the auto increment counter

In MySQL if you need to reset the AUTO_INCREMENT counter (i.e. After you did a bunch of deletes) you can run the following command:

ALTER TABLE MyTable AUTO_INCREMENT = 924;

This will cause 924 to be the next number given out for your AUTO_INCREMENT column.

Leave A Reply
All content licensed under the Creative Commons License