Fix Autoincrement problem

When you delete an record from one table, and you have there an auto_increment record, you will see that mysql keep that record on cache.
Ex. You have 10 rows on your table and you need to delete the last 3, so you have now 7 rows, but when you add the next row (8th), you will see that mysql create it as 11 instead of 8.

To fix it you need to use the command below.

ALTER TABLE tablename AUTO_INCREMENT=111

Where tablename is your table name and 111 is the record you want mysql to start incrementing from.

  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

Reset Lost Root Password

Step 1: Stop MySQL daemon if it is currently running Step 2: Run MySQL safe daemon with skipping...