In MySQL, I have a table, and I want to set the auto_increment
value to 5
instead of 1
. Is this possible and what query statement does this?
相关问题
- sqlyog export query result as csv
- NOT DISTINCT query in mySQL
- MySQL: conduct a basic search
- Why sometimes there is one of more gap(s) in the v
- mySQL alter table on update, current timestamp
just export the table with data .. then copy its sql like
now change auto increment value and execute sql.
Procedure to auto fix AUTO_INCREMENT value of table
How to auto increment by one, starting at 10 in MySQL:
This auto increments the id column by one starting at 10.
Auto increment in MySQL by 5, starting at 10:
This auto increments the id column by 5 each time, starting at 10.
You can use
ALTER TABLE
to change the auto_increment initial value:See the MySQL reference for more details.
If you need this procedure for variable fieldnames instead of
id
this might be helpful:You can also do it using phpmyadmin. Just select the table than go to actions. And change the Auto increment below table options. Don't forget to click on start