I am using MySQL 5. I need to set the seed value as 1000 for my auto increment field. How can I set it?
Asked
Active
Viewed 1.7k times
2 Answers
15
To set when creating your table:
CREATE TABLE xxx(...) AUTO_INCREMENT = 1000;
To set after creating the table:
ALTER TABLE xxx AUTO_INCREMENT = 1000;

Julien Lebosquain
- 40,639
- 8
- 105
- 117
11
If the table already exists, you can do this:
ALTER TABLE mytable AUTO_INCREMENT = 1000;
But make sure the highest value in the auto_increment column is less than 1000.
If you are creating a new table, you can do this:
CREATE TABLE mytable (id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT)
AUTO_INCREMENT = 1000;

simhumileco
- 31,877
- 16
- 137
- 115

Asaph
- 159,146
- 25
- 197
- 199