自动将MySQLdump转储到本地计算机(Windows) [英] Automate MySQLdump to local computer (Windows)

查看:92
本文介绍了自动将MySQLdump转储到本地计算机(Windows)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将mysqldump从远程主机自动化到我的计算机,但我不知道该怎么做.

I'd like to automate a mysqldump to my computer from a remote host, and I cannot figure out how to do it.

我想我应该通过SSH隧道运行mysqldump,但是由于我的本地计算机是Windows XP计算机,这一点变得很复杂.我正在用腻子像这样打开隧道:

I suppose that I should run a mysqldump through an SSH tunnel, but this becomes complicated by the fact that my local computer is a Windows XP machine. I'm using putty to open a tunnel like so:

putty -load "[my saved session]" -L [localport]:localhost:3306 -N

注意:我不能只是远程连接到mysql服务器.

Note: I can't just connect to the mysql server remotely.

推荐答案

而不是PuTTY,请下载命令行版本plink.exe.然后,使用相同的连接参数,您可以通过plink运行mysqldump并将输出保存在本地.可从与PuTTY相同的下载页面获得PLink.

Instead of PuTTY, download the command line version plink.exe. Then using the same connection parameters you can run the mysqldump via plink and save the output locally. PLink is available from the same download page as PuTTY.

# setup the tunnel with plink
plink -load "[my saved session]" -L [localport]:localhost:3306
# Mysqldump your local port, redirected to outfile
mysqldump --port=[localport]  -h localhost -uuser -ppassword dbname > outfile

http://www.chiark.greenend.org.uk /~sgtatham/putty/download.html

或者,另一种方法是在与plink相同的命令行中执行mysqldump,将其重定向到本地计算机上的outfile.

Or, another method would be to execute mysqldump in the same command line as plink, redirecting it to outfile on the local machine.

plink -load "[my saved session]" mysqldump -uuser -ppassword dbname > outfile

这篇关于自动将MySQLdump转储到本地计算机(Windows)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆