4

I have an int column which is set to be auto_increment by 1, however, i cant figure out how to make the column start at the number 10000 instead of 1.

Thanks!

let me clarify I want it by 1, but to start at 10,000, so i would get 10000, 10001, 10002, 10003

3 Answers3

13

Try to do this:

ALTER TABLE your_table AUTO_INCREMENT = 10000;
Marco
  • 56,740
  • 14
  • 129
  • 152
  • let me clarify I want it by 1, but to start at 10,000, so i would get 10000, 10001, 10002, 10003 –  Nov 15 '11 at 15:52
  • @Mike: yes, exactly what I wrote ;) – Marco Nov 15 '11 at 15:54
  • i guess when i read that to me its increase increments by 10000 –  Nov 15 '11 at 15:56
  • @Mike: no, that's the starting value; then everytime you insert a new record passing null as id (or not using it in your query) it's incremented by one. – Marco Nov 15 '11 at 15:58
3

If you have phpmyadmin:

Select the table you need, then go to Operations. There you have an input field called AUTO_INCREMENT. Type the number you want here and viola.

Tessmore
  • 1,054
  • 1
  • 9
  • 23
1
ALTER TABLE  `your_table` AUTO_INCREMENT=10000
matino
  • 17,199
  • 8
  • 49
  • 58