Set MySQL Auto Increment Manually

Popular Related Items »

5 Comments »

  1. Søren Jansen said,

    September 2, 2006 @ 20:18

    Great point

  2. Mikkel Andersen said,

    April 25, 2007 @ 6:28

    Hello,

    Thank you for this great tip.

    It s always great to be able set the offset for auto generated ids in the database

  3. wqewqe said,

    December 24, 2007 @ 2:01

    ALTER TABLE tbl_name AUTO_INCREMENT = xxx

  4. Kiran said,

    June 25, 2009 @ 17:12

    Hmmm, the problem lies in setting it automatically :

    ALTER TABLE tbl_name AUTO_INCREMENT = (Select MAX(Contactid) from tablename);

    I need it for automation scripts. Hope this bug gets resolved..

  5. Remco said,

    July 20, 2009 @ 12:29

    Appearantly if you set auto_increment to 1 mysql sets it to max(id) automagically.

    Quite annoying if you want to raise certain errors for testing.

RSS feed for comments on this post · TrackBack URI

Leave a Comment