Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
200 views
in Technique[技术] by (71.8m points)

mysql - mysqldump from remote host

Is it possible to dump a database from a remote host through an ssh connection and have the backup file on my local computer.

If so how can this be achieved?

I am assuming it will be some combination of piping output from the ssh to the dump or vice versa but cant figure it out.

question from:https://stackoverflow.com/questions/13594895/mysqldump-from-remote-host

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This would dump, compress and stream over ssh into your local file

ssh -l user remoteserver "mysqldump -mysqldumpoptions database | gzip -3 -c" > /localpath/localfile.sql.gz 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...