How to manually set seed value as 1000 in MySQL

梦想与她 提交于 2019-11-30 01:40:23

问题


I am using MySQL 5. I need to set the seed value as 1000 for my auto increment field. How can I set it?


回答1:


To set when creating your table:

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

To set after creating the table:

ALTER TABLE xxx AUTO_INCREMENT = 1000; 



回答2:


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;


来源:https://stackoverflow.com/questions/1536065/how-to-manually-set-seed-value-as-1000-in-mysql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!