Avatar of jonofat
jonofat
 asked on

Starting number in MYSQL auto inc field

If someone inserts a record it starts at 1 and then every record there increases by one automatically so, 2, 3, 4 and so on. Is there a way to make it start at 17589 and then just auto inc from there ie: 17589 then next record will be 17590 and so on. If i try type 17589 as a default value for this column in the table it gives me an error and won't let me save it like that.
PHPMySQL Server

Avatar of undefined
Last Comment
Vampireofdarkness

8/22/2022 - Mon
Benji_

Insert a record with a manual number in the Auto Num column with the number before the next generated.

Ben
jonofat

ASKER
It is a primary key though and won't let me do that?
Benji_

Or another option

Run the following query:
SET insert_id = 17589;
INSERT INTO tablename VALUES ('blah', '...');

This will add the next record into  as 17589.

The SET insert_id = #(where # is the next auto increment value you want to use) will reset the next auto increament value, the next query(INSERT) you run will use your choice of value.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ASKER CERTIFIED SOLUTION
Vampireofdarkness

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.