Get me outta here!

Wednesday, March 14, 2018

How to reset primary key for a table

set @autoid:=0;
update tablename set id = @autoid:=(@autoid+1);
alter table tablename auto_increment = 1;



//Reset row of database auto_increment
ALTER TABLE tablename AUTO_INCREMENT = 1

0 comments:

Post a Comment