Clearing Out Test Data/Resetting Auto-increment fields
am 19.10.2005 05:01:36 von Chris Montgomery
I'm running MySQL 4.1.12 and have been testing a new web application. I
am now ready to stand up a live app and will be clearing out test data
from several tables. How is it possible to reset the auto-incrementing
primary key fields so that they start incrementing from 1 when the site
goes live? Appreciate any pointers on how to do this. Thanks much.
--
Chris Montgomery
--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org
Re: Clearing Out Test Data/Resetting Auto-increment fields
am 19.10.2005 05:25:27 von Peter Monk
Chris Montgomery wrote:
> I'm running MySQL 4.1.12 and have been testing a new web application. I
> am now ready to stand up a live app and will be clearing out test data
> from several tables. How is it possible to reset the auto-incrementing
> primary key fields so that they start incrementing from 1 when the site
> goes live? Appreciate any pointers on how to do this. Thanks much.
A quick google turned up:
TRUNCATE TABLE
(delete all records and reset autoincrement counters)
ALTER TABLE AUTO_INCREMENT = xxx
(resetting to xxx without deleting records)
Peter.
--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org