Home / Databases / MySQL / How can I reset the auto_increment id field in my table?
How can I reset the auto_increment id field in my table?
Last updated: 06/28/2009
First, delete all records in the table (assuming you want to start at 1). Then run this command:
ALTER TABLE tablename AUTO_INCREMENT = 1
Note: If you don't delete all records first, this will reset the next number to 1+ the highest number in your table. This might be useful if you remove a bunch of records at the top end of the table.