How To Reset MySQL Autoincrement Column - MySQL Developer Tutorial

How To Reset MySQL Auto- increment Column

Auto Increment is feature in MySQL that enabled the column in the table to increment automatically. Once you create the column with Auto increment,the value starts with 1 and on each new insert it increases by 1 automatically.

Often we get into situation where we need to reset the value. There are different ways we can reset the value of Auto Increment.

1) Truncate Table : 

If you don't need the data in the table, then you can simple Truncate the table and it will reset the Auto Increment value for Column.  If you use Delete statement, that does not reset Auto Increment Column.

To truncate table , you can use below syntax.

Truncate table YourTableName;

2) Drop and Recreate Table :

If you really don't care about the data, you can simple script out the table definition, drop the table and recreate the table. that will reset the auto increment column value.

3) Reset the Auto Increment Directly :

You can set the Auto Increment value for the table directly. Remember that you can not reset the value lower than the max value which is already used in your auto increment table.

Let's say if I have a table customer and it has 5 rows. The last value for auto increment is 5. I can run the below statement, it will run fine but will not reset the value for Auto increment.

alter table customer auto_increment=1;

When I will insert the next row, the value will start with 6.
If I would like to reset the value higher than the max value in auto increment ( that is 5 in my case)  , I can do that.Let's say if I want to skip and start with 100. I can use below statement for customer.

alter table customer auto_increment=100;

Reset Auto Increment Column in MySQL Table - MySQL Developer Tutorial


  1. Online health & safety essay writing services are very difficult to complete and many students are always searching for Health & Safety Writing Services to help them complete their health & safety research paper writing services and health & safety coursework writing services.

  2. Department of Secondary Education, Sylhet Division also conducted an evaluation process to the valuation of subject wise marks through JSC Result 2022 Sylhet answer sheet correction and the process of evaluation will be complete in before 2nd week of December 2022 and the education board will update answer scripts with student wise mark sheets in subject wise with total GPA grade points to Secondary and Higher Secondary Education Board Bangladesh.

  3. Thanks for sharing the detailed steps to reset the auto increment in MySQL. I am not good at programming and the same in databases. To avoid low grades in these subjects, I always prefer to hire cheap assignment writing services to complete my computer science assignments. It helps me focus on interesting subjects like data analysis and marketing.