HOWTO: Reset your MySQL Table Auto Increment Value
Something I seem to do quite regularly at the moment is resetting the auto increment value for a table in a MySQL database.
Really easy to do but also very easy to forget the syntax:
ALTER TABLE tablename AUTO_INCREMENT = value;
For example
If I had a products table and I created a few new products and then deleted them, to set the auto increment value back to ‘53′ i would simply:
ALTER TABLE products AUTO_INCREMENT = 53;

February 7th, 2009 at 5:20 am
thanks..