mysqldump to another host using ssh

Sometimes you will find yourself on a machine without space to dump the database locally, you can get around this limitation using mysqldump piped over ssh.

mysqldump -uuser -ppass -hhostname database | gzip -c | ssh user@host ‘cat > ~/dump.sql.gz’

Leave a Reply

Your email address will not be published. Required fields are marked *