0

I'm using RStudio on OSX and have a local vm running Ubuntu. I'm having issues with RMySQL connecting to mysql running on the local vm via ssh. I've tried forwarding port 3307 via

ssh -L 3307:d.local.internal.com:3306 ubuntu@d.local.internal.com

followed by the following in r

con <- dbConnect(RMySQL::MySQL(), host = "127.0.0.1", user = "root", password = "pass", port=3307)

I'm still getting

Error in .local(drv, ...) : Failed to connect to database: Error: Can't connect to MySQL server on '127.0.0.1' (57)

Any ideas? I am able to successfully connect via SequelPro with the same ssh and mysql credentials.

1 Answers1

0

Try ssh -L 3307:localhost:3306 ubuntu@d.local.internal.com

I bet d.local.internal.com can't resolve d.local.internal.com hostname, because you may not have DNS entry for d.local.internal.com in the DNS server used by d.local.internal.com or for that matter a /etc/hosts entry.

Also you don't need to setup your local port to 3307, you can use 3306, provided you don't have anything listening on 3306 on your host.