Mysql proxy socks

Simple and understandable, can someone explain to me how to connect to the MySQL server through a proxy (socks4 / 5). It is preferable through the mysql command line (although there are no options for this in the client).

If this is not possible via the mysql command line, then ANY other method will work.

+4
source share
3 answers

As far as I know, this cannot be done through the command line, because the mysql command does not support proxy connections.

If the client and server are on a UNIX machine, and one of them is accessible externally, I suggest using the SSH tunnel. This is basically a secure, tunneled TCP connection that can be used for anything, and the local mysql command can easily connect to the tunnel port.

If this parameter is missing, you can write some kind of executable wrapper file. For example, Java and Ruby have libraries that allow you to talk to SOCKS proxies and connect these sockets before implementing the MySQL or JDBC protocol. What happens then depends entirely on what you have planned next.

+3
source

All you need to do is install and configure tsocks (transparent socks). It is available on most, if not all Linux distributions. After that, you only need to attribute the command "tsocks", for example: tsocks mysql -h -P .....

+5
source

If you have administrator access to a proxy server, will there be a lot of mileage in installing MySQL Proxy on it?

-1
source

All Articles