Reset MySQL auto increment to 1
11 December 2008
No Comment
Here’s a quick reference to reset the MySQL auto_increment field to 1 and delete ALL rows in a table. This is useful in case you had to do some testing and wanted to reset the primary key field back to 1 and clear out the table.
truncate table [NAME OF TABLE]
If you don’t want to wipe out the table, you can reset the auto_increment by using:
alter table [NAME OF TABLE] auto_increment=1









Leave your response!