Clearing Out Test Data/Resetting Auto-increment fields

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 [at] m.gmane.org
Chris Montgomery [ Mi, 19 Oktober 2005 05:01 ] [ ID #1020238 ]

Re: Clearing Out Test Data/Resetting Auto-increment fields

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 <TABLENAME>
(delete all records and reset autoincrement counters)

ALTER TABLE <TABLENAME> 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 [at] m.gmane.org
Peter Monk [ Mi, 19 Oktober 2005 05:25 ] [ ID #1020239 ]
Datenbanken » gmane.comp.db.mysql.windows » Clearing Out Test Data/Resetting Auto-increment fields

Vorheriges Thema: simple query question
Nächstes Thema: mysqldump and database name is like '^-'