mysql 代理袜子
简单明了,谁能解释一下如何通过代理(socks4/5)连接到mysql服务器。最好通过 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).
If it's not possible through the mysql command line than ANY other method will work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您所需要做的就是安装和配置tsocks(透明袜子)。它在大多数(如果不是全部)Linux 发行版中都可用。之后,您只需在命令前加上“tsocks”前缀即可,例如:
tsocks mysql -h -P .....
All you need is to install and configure tsocks (transparent socks). It's available in most if not all linux distibutions. Afterwards you only need to prefix your command with 'tsocks', for example:
tsocks mysql -h -P .....
据我所知,无法通过命令行完成,因为mysql命令不支持代理连接。
如果客户端和服务器都在一台 UNIX 计算机上,并且其中之一可以从外部访问,我建议使用 SSH 隧道。它基本上是一个安全的隧道 TCP 连接,可用于任何用途,并且本地 mysql 命令可以轻松连接到隧道端口。
如果没有选择,您可以编写某种包装可执行文件。例如,Java 和 Ruby 具有使您能够与 SOCKS 代理通信并将这些套接字连接到 MySQL 或 JDBC 协议实现的库。接下来会发生什么完全取决于你接下来的计划。
To my knowledge, it can't be done through the command line because the mysql command does not support proxy connections.
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.
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 Proxy 会很费力吗?
If you've got admin access to the proxy server would there be much mileage in installing MySQL Proxy on it?