I have a MySql 5.1.52 database with a table which has consistently forgotten its autonumber sequence and then subsequently started from 1 again. It can take hours, days or weeks for this reset to occur.

Some have suggested that its related to clearing the table, that being empty it is unable to maintain its autonumber. Performing a few tests of my own to prove this theory failed. The table remembers its autonumber sequence even when cleared of all rows.

Do you know why this could be happening ?

有帮助吗?

解决方案

InnoDB tables reset their autoincrement to MAX(auto_inc_column)+1 when the server starts. If the table is empty it resets to 1.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top