Reputation: 9040
I need to reset my table counter back to 0 - is there a MySQL command for this?
Upvotes: 28
Views: 28678
Reputation: 105916
You can also use the TRUNCATE statement. It will remove all the data and reset the auto increment.
TRUNCATE TABLE [TableName];
Is the same as
DELETE * FROM [TableName];
ALTER TABLE [TableName] AUTO_INCREMENT = 0;
Upvotes: 19