Created
February 24, 2012 11:11
-
-
Save grekko/1900200 to your computer and use it in GitHub Desktop.
MySQLdump all database in separate files
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 | |
DBUSER=root | |
DBPASS=deinrootpasswort | |
DUMPDIR=./DatabaseDumps | |
DUMPDATE=$(date '+%Y-%m-%d') | |
if [ ! -d $DUMPDIR ] ; then | |
mkdir $DUMPDIR | |
fi | |
for IDX in $(echo "show databases;" |mysql --user=$DBUSER --password=$DBPASS -s) | |
do | |
mysqldump --user=$DBUSER --password=$DBPASS --databases $IDX > $DUMPDIR/${IDX}_${DUMPDATE}.sql | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment