Find the answer to your Linux question:
Results 1 to 2 of 2
have an AUTOINCREMENT field, which works for every record added....1, 2, 3, my question is this, when i am done testing i want to start at ONE again, but even ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2004
    Posts
    4

    Clear an autoincrement


    have an AUTOINCREMENT field, which works for every record added....1, 2, 3,

    my question is this, when i am done testing i want to start at ONE again, but even if i delete all records, it still keeps SOMWHERE the last UserID,

    how do i reset it to 1?

    thanks

  2. #2
    Just Joined!
    Join Date
    Apr 2004
    Location
    UK
    Posts
    61
    If you use the truncate table command to delete your test data then it will reset the auto incrememnt value (unless you are using innodb tables)

    http://dev.mysql.com/doc/mysql/en/TRUNCATE.html

    Alternatively you can use

    Code:
    ALTER TABLE tbl_name AUTO_INCREMENT = 1
    To reset the auto_increment value

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •