Skip to content

Instantly share code, notes, and snippets.

@jkullick
Last active January 18, 2017 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkullick/55100ff5c8b891b19d9682f79a85700b to your computer and use it in GitHub Desktop.
Save jkullick/55100ff5c8b891b19d9682f79a85700b to your computer and use it in GitHub Desktop.
Reset MySQL Auto Increment Value after Delete
SELECT @max := MAX(ID)+ 1 FROM ABC; 

PREPARE stmt FROM 'ALTER TABLE ABC AUTO_INCREMENT = ?';
EXECUTE stmt USING @max;

DEALLOCATE PREPARE stmt;

Source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment