简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM