How to increase the number of auto-increments of the "primary key"?

I have a column that is a primary key / auto increment.

As more records are created, of course, the number increases.

Right now, if a record is inserted, it will have primary_key of "10".

How to increase the number to 200?

In other words, I want the primary key to now have 200, 201, 202 .... instead of 11, 12, 13.

+4
source share
5 answers

Very simple query:

ALTER TABLE table_name AUTO_INCREMENT=200; 

The MySql documentation mentions this on the ALTER TABLE page.

+3
source

You can set a new value for your auto-increment using:

 ALTER TABLE table_name AUTO_INCREMENT = 200; 
+1
source

Not sure why you need this, but this should work:

ALTER TABLE table_name AUTO_INCREMENT = 200;

+1
source

As indicated in the mysql documentation (which you should read in case of doubt :))

 ALTER TABLE tbl AUTO_INCREMENT = 200; 
+1
source

after changing the table, the newly inserted record starts at 200.

 ALTER TABLE table_name AUTO_INCREMENT = 200; 
+1
source

All Articles