How to reset AUTO_INCREMENT in MySQL?

回覆文章
yehlu
Site Admin
文章: 3245
註冊時間: 2004-04-15 17:20:21
來自: CodeCharge Support Engineer

How to reset AUTO_INCREMENT in MySQL?

文章 yehlu »

https://stackoverflow.com/questions/892 ... t-in-mysql

代碼: 選擇全部

SET  @num := 0;

UPDATE your_table SET id = @num := (@num+1);

ALTER TABLE your_table AUTO_INCREMENT =1;


回覆文章

回到「MySQL」