Created
October 27, 2014 19:24
-
-
Save zufrieden/903641b2d10a57f0b053 to your computer and use it in GitHub Desktop.
Mysql databases backup script OSX
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 | |
TIMESTAMP=$(date +"%F-%H-%M-%S") | |
BACKUP_DIR="/Users/mfh/Dropbox/admin/backups/mysql" | |
MYSQL_USER="root" | |
MYSQL=/usr/local/bin/mysql | |
MYSQL_PASSWORD="password" | |
MYSQLDUMP=/usr/local/bin/mysqldump | |
$MYSQL -s -r -u $MYSQL_USER -p$MYSQL_PASSWORD -e 'show databases' | | |
while read db; do | |
$MYSQLDUMP -u $MYSQL_USER -p$MYSQL_PASSWORD $db > $BACKUP_DIR/$TIMESTAMP-${db}.sql; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment