How to Reset AUTO_INCREMENT in MySQL?

There is a common issue which is usually faced by almost every newbie web developer or database administrator. When you insert records in your table of database after deleting all or some records from that table, if AUTO_INCREMENT property was set on your ID column or any other column, when you insert new records in that table it starts generating ID after the last ID generated by AUTO_INCREMENT in table, the following SQL query can reset the AUTO_INCREMENT from beginning or any number you want. 🙂

SQL Query

You can also reset it from the MySQL => Operations => Table Options. Just change AUTO_INCREMENT to 1.

reset-auto_increment-in-mysql

 

Article By

Javed Ur Rehman is a passionate blogger and web developer, he loves to share web development tutorials and blogging tips. He usually writes about HTML, CSS, JavaScript, Jquery, Ajax, PHP and MySQL.

Leave a Reply

Your email address will not be published. Required fields are marked *