Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reset ID autoincrement ? phpmyadmin [duplicate]

Tags:

php

mysql

I was testing some data in my tables of my database, to see if there was any error, now I cleaned all the testing data, but my id (auto increment) does not start from 1 anymore, can (how do) I reset it ?

like image 714
Marcelo Avatar asked Jun 11 '10 01:06

Marcelo


People also ask

How do I reset Autoincrement?

In MySQL, the syntax to reset the AUTO_INCREMENT column using the ALTER TABLE statement is: ALTER TABLE table_name AUTO_INCREMENT = value; table_name. The name of the table whose AUTO_INCREMENT column you wish to reset.

Does truncate table reset auto increment?

The TRUNCATE TABLE statement removes all the data from a table and resets the auto-increment value to zero.


1 Answers

ALTER TABLE `table_name` AUTO_INCREMENT=1 
like image 74
Sev Avatar answered Sep 22 '22 21:09

Sev