Blog Archive

MySQL set AUTO_INCREMENT value

How To Reset a auto generated Column in MySQL

Auto-increment allows a unique number to be generated when a new record is inserted into a table. By default, the starting value for AUTO_INCREMENT is 1, and it will increment by 1 for each new record.

What if you need to reset the number back to 1?
  • ALTER TABLE table_name AUTO_INCREMENT = 1;
What if you need to bump up the number back to say 5000?
  • ALTER TABLE table_name AUTO_INCREMENT = 5000;