Mr Yar Mr Yar - 1 year ago 95
MySQL Question

how can i change the start id number in mysql

I would like to change the initial number of id from 1 to 2000.
My table :

id value type
1 e photo
2 f text
3 g photo

and here is what i want as result:

id value type
2001 e photo
2002 f text
2003 g photo

Gab Gab
Answer Source

Here is the query to change the auto increment value in your table:


If you just want to add 2000 to all the IDs you can do:

UPDATE my_table SET id = id + 2000;

But its not very clean to do that.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download