0

I (Local Z) do data analysis on a remote server (Server A), and I need to connect to a database (Database D) on another remote server (Server B).

I can connect to Database D by SSH tunneling to Server B from Local Z.

However, I run RStudio Server on Server A, and I need to connect to Database D within RStudio on Server A.

How can I go about SSH tunneling from Server A to Server B and connecting to MySQL within RStudio?

EDIT: I'm using the RMySQL package to connect to the database within RStudio. Database D also only allows local connections, so SSH tunnel is required.

lmo
  • 37,904
  • 9
  • 56
  • 69
alxlvt
  • 675
  • 2
  • 10
  • 18

2 Answers2

0

I think you can try with proxy socket :

root@serverA:~# ssh root@serverB -D 1337

It'll tell ssh on serverA to listening on the localhost:1337, change the port 1337 to use the one of the database (like the distant) and it should be "remotely at home"...

Blag
  • 5,818
  • 2
  • 22
  • 45
-1

Solved: after SSH tunneling from my server to the 2nd server, for some reason (if anyone knows, please add a comment), changing 'localhost' to '127.0.0.1' in the R code allowed me to connect (contrary to settings I've used in similar ways for other databases...).

alxlvt
  • 675
  • 2
  • 10
  • 18