-
-
Save mrintegrity/3786733 to your computer and use it in GitHub Desktop.
pipe a mysql dump through gzip and send it over ssh
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
mysqldump -u MYSQL_USERNAME -p YOUR_DATABASE | gzip -c | ssh USERNAME@YOUR_TO_HOST 'cat > ~/dump.sql.gz' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Or .... assuming you're on Debian/Ubuntu which has /etc/mysql/debian.cnf with credentials in it ...
ssh USERNAME@FROM_SERVER 'mysqldump --defaults-extra-file=/etc/mysql/debian.cnf --add-drop-tables --databases db1 db2 db3 | gzip -c ' | zcat -d | mysql --defaults-extra-file=/etc/mysql/debian.cnf