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;

No comments:

Post a Comment

NO JUNK, Please try to keep this clean and related to the topic at hand.
Comments are for users to ask questions, collaborate or improve on existing.