# phpmyadmin/mysql autoincrement



## andehlu (Aug 29, 2005)

Hey all,

I have my primary key as auto increment everything is working fine. But I am in developement right now and when I delete all records then make another insert the id is still as if the old records were there.. is there anyway to reset the increment value back to 0 thru myadmin. I see where it says increment value, 'Next Index' but i cant see how to reset it...thanks.


----------



## macbri (Aug 29, 2005)

You could click on the "SQL" tab in phpMyAdmin and just use the MySQL command:


```
ALTER TABLE theTableInQuestion AUTO_INCREMENT=0
```

Take a look at this section and comments in the MySQL manual  for more info on this action.


----------



## andehlu (Aug 29, 2005)

hmmm i tried this, myadmin says that it executes successfully but my Next Autoindex has not changed and new records do not start at 0.... thanks for the link Ill look into it more.


----------



## ksv (Aug 30, 2005)

It should reset with

```
TRUNCATE TABLE `tbl_name`;
```
which empties table data and indexes


----------



## andehlu (Aug 30, 2005)

nice, that worked .... thanks.


----------

