Dennis
Dennis

Reputation: 1156

Make mysql client use ALL_PROXY socks5 server

I want to connect to an aurora serverless database from my local machine. Because the database is only accessible from within the aws cloud, I have setup an ec2 instance running microsocks:

./microsocks -p 8888

I now want to connect using mysql from my machine:

export ALL_PROXY=socks5h://xx.xx.xx.xx:8888

mysql --user=admin --password=XXXX -h database-XXXX.cluster-XXXX.eu-XXXX.rds.amazonaws.com

ERROR 2003 (HY000): Can't connect to MySQL server on 'database...com' (111)

If I run this command on the ec2 instance it succeeds. So I assume that mysql does not respect my proxy settings. If I run curl on my machine it respects the proxy settings.

Note that this is just for testing purposes and I know that this would not be a solution for production use.

Upvotes: 1

Views: 1335

Answers (1)

itanch
itanch

Reputation: 1

You may use proxychains.

yum install  proxychains-ng

edit config file /etc/proxychains.conf, and add this:

[ProxyList]
# add proxy here ...
# meanwile
# defaults set to "tor"
socks5  {your proxy.address} {your.proxy.port} 

Lastly, you can run mysql like this:

proxychains mysql --user=admin --password=XXXX -h database-XXXX.cluster-XXXX.eu-XXXX.rds.amazonaws.com

Upvotes: 0

Related Questions