Change auto increment starting number?

John Jones picture John Jones · Jun 9, 2009 · Viewed 312.9k times · Source

In MySQL, I have a table, and I want to set the auto_increment value to 5 instead of 1. Is this possible and what query statement does this?

Answer

Daniel Vandersluis picture Daniel Vandersluis · Jun 9, 2009

You can use ALTER TABLE to change the auto_increment initial value:

ALTER TABLE tbl AUTO_INCREMENT = 5;

See the MySQL reference for more details.