MySQL

33. MySQL Auto_increment 재정렬

drizzle0925 2021. 9. 9. 10:34
728x90

auto_increment 재정렬하기

# auto_increment 값 초기화
ALTER TABLE [테이블이름] auto_increment = 1;
SET @cnt = 0;
UPDATE [테이블 이름] SET [테이블 이름].[컬럼 이름] = @cnt:=@cnt+1

 

728x90