-1

I am trying to figure out how to connect to a remote DB server that can only be reached from the webserver using port forwarding with putty.

Here is the setup: There is a webserver with IP 1.2.3.4 that is allowed to connect to the DB server using a private IP of 2.3.4.5 that is listening on port number 22280. Both servers are hosted at digital ocean.

At the moment i am developing a php based website, using xampp and the database that i use its reachable on localhost 3306.

The question is that is there any way to achive a connection to the DB server behind the webserver using port forwarding? I want to use the dev database on the DB server instead of the one on localhost.

Many thanks. Trix

4

1 Answer 1

0

Assuming the web server has a user trix and you want to access the port locally at port 3307, this putty call should work (may be you want to use the user root instead):

putty.exe -L 3307:2.3.4.5:22280 [email protected]

Alternatively you can use the GUI:

  • In the category Session in Host Name type 1.2.3.4
  • in Connection - Data fill in the username (trix in the example)
  • In Connection - SSH - Tunnels:
    • In Source port type 3307
    • In Destination type 2.3.4.5:22280
    • Press Add
  • Open the connection

You can also configure ssh keys, then you do not to type the password. But this is an other topic.

2
  • Well, this is what is already shown in the questions I've linked above. Mar 10, 2021 at 13:50
  • Yes. You're right. I thought, because the questiner seems not to be so well versed in the topic, I can adopt the call to his example. But your links explain the it satisfactorily.
    – Palando
    Mar 10, 2021 at 22:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .