Last active
March 3, 2022 08:58
-
-
Save nilkesede/8e8ffc601201f6cb86f8dc14fd736dca to your computer and use it in GitHub Desktop.
Dump from remote mysql
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 | |
host=$1 | |
user=$2 | |
password=$3 | |
folder=$4 | |
filter='' | |
if [ -n "$5" ]; then | |
filter=" like '$5'" | |
fi | |
databases=`mysql -h$host -u$user -p$password -e "show databases$filter" -s --skip-column-names --ssl-mode=DISABLED` | |
for DB in $databases; do | |
echo $DB | |
mysqldump -h$host -u$user -p$password --ssl-mode=DISABLED $DB > "./$4/$DB.sql"; | |
# docker exec -i mysql57 | |
# --column-statistics=0 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment