Created
January 19, 2013 08:45
-
-
Save abhinavlal/4571478 to your computer and use it in GitHub Desktop.
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