List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:December 30 2002 5:36am
Subject:Re: reset auto-increment value
View as plain text  
At 21:00 -0500 12/29/02, Carlin Anderson wrote:
>I have a number of databases installed under mysql 3.23 and 4.0, and 
>will need to occasionally re-initialize certain tables.  Can I 
>re-set auto-increment fields within those tables?

You can drop and re-create the tables.  This will work for any table type.

For ISAM tables, if you delete all the records, that will automatically
reset the counter.

For MyISAM tables, you can delete all the records, then use:
which will reset the counter.

If what you mean is that you want to leave the existing records intact, but
resequence the AUTO_INCREMENT column so that the sequence doesn't
have holes in it, then I'd ask:  why bother?

>Carlin Anderson

I execute safe_mysqld and it deadsroot30 Dec
  • reset auto-increment valueCarlin Anderson30 Dec
    • Re: reset auto-increment valuePaul DuBois30 Dec