Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
olifile
Forum Newbie
Posts: 6 Joined: Fri Aug 11, 2006 11:00 am
Post
by olifile » Fri Aug 11, 2006 11:06 am
Hi!!
I'm new user!
I have a problem in mysql. I dont know rest autoincrment in MYSQL.
Thank you for reply
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Fri Aug 11, 2006 11:16 am
Luke
The Ninja Space Mod
Posts: 6424 Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA
Post
by Luke » Fri Aug 11, 2006 11:20 am
ALTER TABLE `table` AUTO_INCREMENT =0
RobertGonzalez
Site Administrator
Posts: 14293 Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA
Post
by RobertGonzalez » Fri Aug 11, 2006 11:21 am
Bear in mind that if you have data in your table and you reset the autoincremement pointer that you could run into all sorts of issues if that field is a primary key. I know from experience. It is a pain in the rear.
olifile
Forum Newbie
Posts: 6 Joined: Fri Aug 11, 2006 11:00 am
Post
by olifile » Fri Aug 11, 2006 11:39 am
so simple
Solved
tk you!!
Christopher
Site Administrator
Posts: 13596 Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US
Post
by Christopher » Fri Aug 11, 2006 11:55 am
I believe that:
TRUNCATE mytable;
Is the same as:
DELETE * FROM mytable;
ALTER TABLE `mytable` AUTO_INCREMENT =0;
(#10850)