mysql - Insert new row with id 1 -


is there possibility delete entire data in table , insert new rows id starts 1

delete command helps remove data table when trying insert new row id last inserted row id+1(if last inserted id 5 new id should 6) want store id 1

any suggestions other truncate command, in advance

after deleteing records do

alter table tablename auto_increment = 1 

note

from mysql docs : link

you cannot reset counter value less or equal have been used. myisam, if value less or equal maximum value in auto_increment column, value reset current maximum plus one. innodb, if value less current maximum value in column, no error occurs , current sequence value not changed.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -