At 14:57 -0600 2/7/02, Rick Emery wrote:
>The following deletes all records and re-starts renumbering from 1;
>DELETE FROM mytable;
>The following deletes all records and continues counting from where the
>table last left off:
>DELETE FROM mytable WHERE 1;
>If you are trying to restart numbering while not deleting records,
ALTER TABLE tbl_name
ADD id INT UNSIGNED NOT NULL AUTO_INCREMENT FIRST,
AUTO_INCREMENT = 1;
But why do this? MySQL doesn't care if the sequence has holes in
it or not.
>From: Wei Gao [mailto:alexgaowei@stripped]
>Sent: Thursday, February 07, 2002 2:10 PM
>Subject: Reset auto_increment
>As I am new to MySQL, perhaps this is a common question you have been asked.
>I have a field "Id" which using auto_increment. Now I want to reset the
>value of auto_increment, that is the "Id" starts form 1 and does not skip
>the number. I have spent a few hours to find a way, but all failed. Could
>you please tell me how to do it?