Arringar1
Arringar1

Reputation: 415

Change MySQL auto_increment value without affecting existing rows

Is this possible? Everything I find suggests that it will affect all existing rows if I use alter table and if that happened in my case it would do a lot of damage.

Can someone point me in the right direction here?

Upvotes: 0

Views: 649

Answers (1)

Explosion Pills
Explosion Pills

Reputation: 191729

You can't change the auto_increment value with ALTER to a number that is less than the maximum auto incremented value. MySQL won't let you. If you want to change the value to higher than 1 + the max auto increment value you can do that, but there will be a gap.

Upvotes: 1

Related Questions