-
-
Save faisal-ibrahim/b662da6a4d1c886d5ff45be07590ca00 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