问题描述
简单明了,谁能解释一下如何通过代理 (socks4/5) 连接到 mysql 服务器.最好通过 mysql 命令行(尽管客户端中没有选项).
Plain and simple, can anyone explain me how to connect to a mysql server through a proxy (socks4/5). Preferable via the mysql command line (although there are no options for that in the client).
如果无法通过 mysql 命令行,则任何其他方法都可以工作.
If it's not possible through the mysql command line than ANY other method will work.
推荐答案
据我所知,无法通过命令行完成,因为 mysql 命令不支持代理连接.
To my knowledge, it can't be done through the command line because the mysql command does not support proxy connections.
如果客户端和服务器都在 UNIX 机器上,并且其中一个可以从外部访问,我建议使用 SSH 隧道.它基本上是一个安全的隧道 TCP 连接,可以用于任何事情,本地 mysql 命令可以轻松连接到隧道端口.
If both client and server are on a UNIX machine and one of them is accessible from the outside, I suggest using an SSH tunnel. It's basically a securely tunneled TCP connection that can be used for anything and the local mysql command can connect to the tunnel port easily.
如果没有选择,您可以编写某种包装器可执行文件.例如,Java 和 Ruby 具有使您能够与 SOCKS 代理对话并将这些套接字连接到 MySQL 或 JDBC 协议实现的库.然后会发生什么完全取决于您接下来的计划.
If that's no option, you could write some kind of wrapper executable. For example, Java and Ruby have libraries that enable you to talk to SOCKS proxies and hook those sockets up to a MySQL or JDBC protocol implementation. What happens then depends entirely on what you have planned next.
这篇关于mysql 代理袜子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!