Ruby Mysql2 via proxy (QuotaGuard)

2019-07-19 03:11发布

问题:

I need to connect to a mysql database using mysql2 gem. Everything works well in local but on Heroku I need a static ip address so I have installed QuotaGuard which provide me a proxy with username and password.

The proxy is working fine (tested with curl)

I'm not able to connect to mysql using it, I saw on a post that you can specify a mysql socket file while connecting but I have absolutely no idea what to put in it, can't find anywhere.

client = Mysql2::Client.new(:host => host, :database => database, :username => username, :password => password, :port => port, :socket => "my_path/to/mysql.sock")

I randomly tried this in my_path/to/mysql.sock but it doesn't affect anything, like it is ignored

route {
  proxy: xxxx:xxxxx@xxxxxx.quotaguard.com
  port: 9293
  proxyprotocol: socks_v5
  method: username
  command: connect
}

Thanks