Last active
December 21, 2015 10:39
-
-
Save cal/6293395 to your computer and use it in GitHub Desktop.
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 | |
credentials='' | |
database='' | |
TABLES=`mysql $credentials -B -N -e "select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='$database'"` | |
for table in $TABLES; do | |
echo -n "dumping $database.$table... " | |
if [[ $table == cache* ]]; then | |
option="--no-data" | |
else | |
option="" | |
fi | |
mysqldump $credentials $option $database $table | gzip > $database.$table.sql.gz | |
echo "done" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment