Running mysqldump via ssh (direct host to host copy)

In order to run a mysqldump from one host to another over SSH you can run:

mysqldump dbname | ssh [email protected] "mysql -D dbname"

This will pipe the output of mysqldump directly to the ssh connection which is running MySQL at the other end and receiving the mysqldump from standard input.

2 thoughts on “Running mysqldump via ssh (direct host to host copy)”

  1. What if I’m using Putty to ssh from windows to a linux server? i.e. my command line command isn’t:

    >>> ssh

    rather:

    >>>putty -load “[my saved session]”

    I ask because when I run the foregoing, it won’t let me tack on a command to run once the connection is established.

Leave a Reply

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