id从1开始自增 SET @i=1; UPDATE `tablename` SET `id`=(@i:=@i+1); ALTER TABLE `tablename` AUTO_INCREMENT=1; 转载于:https://www.cnblogs.com/weifeng-888/p/11637633.html