It is possbile set/reset the AUTO_INCREMENT value of a MySQL table via
ALTER TABLE some_table AUTO_INCREMENT = 1000
However I need
I found this gist on github and it worked like a charm for me: https://gist.github.com/abhinavlal/4571478
The command:
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;"
If your DB requires a password, you unfortunately have to put that in the command for it to work. One work-around (still not great but works) is to put the password in a secure file. You can always delete the file after so the password doesn't stay in your command history:
... | xargs -I {} mysql -u root -p`cat /path/to/pw.txt` DB_NAME -e...