Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MySQL on localhost - Auto Increment 1

Status
Not open for further replies.

uniopp

Technical User
Oct 7, 2001
152
JP
Hi,
Can anyone tell me how/where MySQL running on my localhost (Win XP - Apache2) stores auto increment numbers.
How does it remember what the last number assigned was? I tried deleting all the records in the table but it still remembers what the last auto increment number was and continues on from there.
It must store it somewhere but I don't know where.
I would like to reset the number back to 1 but I'm not sure what to do.
Any ideas?
Thank you.
 
What version of MySQL are you running?

On older versions, performing the query "DELETE from tablename", which deletes all records, is optimized to actually drop and recreate the table. This will reset the counter.

On newer versions, you'll have to issue the query: ALTER TABLE foo auto_increment=1

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top