如何从本地机器mysqldump远程数据库 - how to mysqldump remote db from local machine

10/17 04:04
阅读数 0

问题:

I need to do a mysqldump of a database on a remote server, but the server does not have mysqldump installed.我需要在远程服务器上对数据库进行 mysqldump,但该服务器没有安装 mysqldump。 I would like to use the mysqldump on my machine to connect to the remote database and do the dump on my machine.我想在我的机器上使用 mysqldump 连接到远程数据库并在我的机器上进行转储。

I have tried to create an ssh tunnel and then do the dump, but this does not seem to work.我试图创建一个 ssh 隧道,然后进行转储,但这似乎不起作用。 I tried:我试过:

ssh -f -L3310:remote.server:3306 user@remote.server -N

The tunnel is created with success.隧道创建成功。 If I do如果我做

telnet localhost 3310

I get some blurb which shows the correct server mysql version.我得到了一些显示正确服务器 mysql 版本的简介。 However, doing the following seems to try to connect locally但是,执行以下操作似乎尝试在本地连接

mysqldump -P 3310 -h localhost -u mysql_user -p database_name table_name

解决方案:

参考一: https://en.stackoom.com/question/CXlM
参考二: https://stackoom.com/question/CXlM
展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部