Created
July 25, 2013 09:51
-
-
Save riccamastellone/6078351 to your computer and use it in GitHub Desktop.
Extremely simple script to list and backup all your MySQL dbs to Amazon S3 using s3cmd (http://s3tools.org/).
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 | |
dblist=`mysql -u root -pYOURPASSWORD -e "show databases" | sed -n '2,$ p'` | |
for db in $dblist; do | |
if [ $db != 'performance_schema' ] && [ $db != 'mysql' ] && [ $db != 'information_schema' ] | |
then | |
mysqldump -u root -pYOURPASSWORD $db > /var/backup/db/$db.sql | |
s3cmd --no-progress --mime-type="application/octet-stream" put /var/backup/db/$db.sql s3://YOURBUCKET/backup-db/$db.sql | |
fi | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment