Reset your MySQL Table Auto Increment Value
Recently,I created tables using auto increment number as the Primary Key. As name say, the number will increase every time I insert new record into the table. At some point I wanted to delete the whole dummy data I inserted.
eg.
If I had a items table and I created a few new items and then deleted them, to set the auto increment value back to ‘100′ i would simply:
ALTER TABLE tablename AUTO_INCREMENT = value;
eg.
If I had a items table and I created a few new items and then deleted them, to set the auto increment value back to ‘100′ i would simply:
ALTER TABLE items AUTO_INCREMENT = 100;
Comments
http://webobserve.blogspot.com/2011/02/reset-mysql-table-autoincrement.html