MySQL auto increment ID suddenly jumped to MAXINT, what could be a reason?

前端 未结 2 885
刺人心
刺人心 2021-01-19 07:05

I have a mysql table with about 2,000,000 entries, with a primary key which is auto incrementing. However, at one point the auto increment value suddenly jumped from what it

2条回答
  •  无人及你
    2021-01-19 07:24

    A failed insert can still cause the auto-increment column to increase. If your program went into an infinite loop of failures it could cause the limit to be reached.

    It's also possible to set the auto-increment programmatically to a specific value.

    ALTER TABLE yourtable AUTO_INCREMENT = 12345;
    

提交回复
热议问题