JD Isaacks
JD Isaacks

Reputation: 57974

MySQL: Is there a way to reset a table?

Is there a way to reset a table?

I mean not only deleting all rows, but starting the auto_incrementing ID back to 0?

Upvotes: 5

Views: 226

Answers (1)

D'Arcy Rittich
D'Arcy Rittich

Reputation: 171421

To remove all data:

TRUNCATE TABLE tablename

To reset the auto-increment:

ALTER TABLE tablename AUTO_INCREMENT = 1

Upvotes: 11

Related Questions