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.
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.
Looks like someone on stackoverflow.com answered it for me: http://stackoverflow.com/questions/6564882/automate-mysqldump-to-local-computer-windows