-
-
Save ozscosta/64575f578f2c3806cf84bebae93a43c0 to your computer and use it in GitHub Desktop.
[Reset mysql autoincrement keys] Reset auto increment of all tables in a mysql database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql -Nsr -e "SELECT t.table_name FROM INFORMATION_SCHEMA.TABLES t WHERE t.table_schema = 'DB_NAME'" | xargs -I {} mysql DB_NAME -e "ALTER TABLE {} AUTO_INCREMENT = 1;" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment