Re: mySQL reset auto_increment

From: Date: Tue, 03 Jul 2001 00:27:39 +0000
Subject: Re: mySQL reset auto_increment
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-55911@lists.php.net to get a copy of this message
Jon Shoberg pressed the little lettered thingies in this order... > > Is there an SQL query for resetting the autoincrement field of a table ? I > know myisamchk will do this but the system I am on will not let me us it. > I can get console level access but that is all. I simply want to reindex > my data back to the start of 1. > Drop the column and re-add it. From the command line MySQL client tool: ALTER TABLE table, DROP increment_column, ADD increment_column INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY; If you have other tables referencing the auto_increment field in this table, you're really going to mess things up regardless of how you resequence these values. If no other tables interact with this one (or if you can easily and manually recreate the interactivity), you shouldn't have any problems. Christopher Ostmo a.k.a. tech@AppIdeas.com AppIdeas.com Meeting cutting edge dynamic web site needs For a good time, http://www.AppIdeas.com/

« previous php.general (#55911) next »