Created
June 3, 2015 13:34
-
-
Save jemekite/8c801b6be2e9ae134f60 to your computer and use it in GitHub Desktop.
Dump every databases on the server
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 | |
USER="root" | |
PASSWORD="[yourpass]" | |
ExcludeDatabases="Database|information_schema|performance_schema|mysql" | |
databases=`mysql -u $USER -p$PASSWORD -e "SHOW DATABASES;" | tr -d "| " | egrep -v $ExcludeDatabases` | |
for db in $databases; do | |
echo "Dumping database: $db" | |
#mysqldump -u $USER -p$PASSWORD --databases $db > `date +%Y%m%d`.$db.sql | |
mysqldump -u $USER -p$PASSWORD --databases $db | gzip > `date +%Y%m%d`.$db.sql.gz | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment