tags:

views:

30

answers:

2

I need to reset my table counter back to 0 - is there a MySQL command for this?

+5  A: 

That's easy:

ALTER TABLE tablename AUTO_INCREMENT=0;
Andomar
+1 cause we posted it at the same time.
Jeremy Morgan
+1  A: 

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;
Peter Bailey