Last active
November 22, 2015 01:27
-
-
Save janzikan/9016378 to your computer and use it in GitHub Desktop.
Backup MySQL databases
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
#!/bin/bash | |
cd [backup_folder] | |
today=`date +%Y-%m-%d` | |
filename="mysql/mysql-$today.sql" | |
# Backup all databases | |
# mysqldump -u [username] -p[password] --all-databases > $filename | |
# Backup listed databases | |
mysqldump -u [username] -p[password] --databases [db1] [db2] > $filename | |
# Sync backup file to another folder | |
rsync -a --inplace $filename [sync_folder] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment