LoginSignup
1
0

More than 3 years have passed since last update.

【MySQL】AUTO INCREMENTのリセット【個人的備忘】

Last updated at Posted at 2019-05-16

AUTO INCREMENTのカラムがあるテーブルに対してdeleteを実行しても、AUTO INCREMENTの値はリセットされません。

その場合は以下のSQLを実行し、任意の数値からAUTO INCREMENTが開始されるように変更する必要があります。

ALTER TABLE "テーブル名" AUTO_INCREMENT = "任意の値";

※任意の値は数値型のため、シングルクオーテーション(')を付けるとエラーになるので要注意

  • 試験環境でdeleteを実施する度に忘れるので自分的備忘として投稿
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0