Created
July 10, 2016 16:59
-
-
Save anytizer/43198c5a11d5d1d71e6f0002832a0227 to your computer and use it in GitHub Desktop.
Backup all databases at once with one shell script.
This file contains hidden or 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
#!/bin/bash | |
# Backup all available databases | |
USERNAME="root"; | |
PASSWORD="password"; | |
for DATABASE in `mysql -u${USERNAME} -p${PASSWORD} -e "SHOW DATABASES;"` | |
do | |
echo mysqldump --routines -u${USERNAME} -p${PASSWORD} ${DATABASE} \> ${DATABASE}.dmp; | |
mysqldump --routines -u${USERNAME} -p${PASSWORD} ${DATABASE} > ${DATABASE}.dmp; | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment