开发者

How to manually set seed value as 1000 in MySQL

开发者 https://www.devze.com 2022-12-08 04:16 出处:网络
I am using MySQL 5. I need to set the seed value as 1000 for my auto increment f开发者_如何转开发ield.

I am using MySQL 5. I need to set the seed value as 1000 for my auto increment f开发者_如何转开发ield. How can I set it?


To set when creating your table:

CREATE TABLE xxx(...) AUTO_INCREMENT = 1000;

To set after creating the table:

ALTER TABLE xxx AUTO_INCREMENT = 1000; 


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;
0

精彩评论

暂无评论...
验证码 换一张
取 消