Unable to connect PostgreSQL to remote database using pgAdmin

前端 未结 7 1143
Happy的楠姐
Happy的楠姐 2020-11-29 18:58

I installed PostgreSQL on my local server (Ubuntu) with IP 192.168.1.10. Now, I\'m trying to access the database from my client machine (Ubuntu) with IP 192.168.1.11 with p

7条回答
  •  悲&欢浪女
    2020-11-29 19:01

    Connecting to PostgreSQL via SSH Tunneling

    In the event that you don't want to open port 5432 to any traffic, or you don't want to configure PostgreSQL to listen to any remote traffic, you can use SSH Tunneling to make a remote connection to the PostgreSQL instance. Here's how:

    1. Open PuTTY. If you already have a session set up to connect to the EC2 instance, load that, but don't connect to it just yet. If you don't have such a session, see this post.
    2. Go to Connection > SSH > Tunnels
    3. Enter 5433 in the Source Port field.
    4. Enter 127.0.0.1:5432 in the Destination field.
    5. Click the "Add" button.
    6. Go back to Session, and save your session, then click "Open" to connect.
    7. This opens a terminal window. Once you're connected, you can leave that alone.
    8. Open pgAdmin and add a connection.
    9. Enter localhost in the Host field and 5433 in the Port field. Specify a Name for the connection, and the username and password. Click OK when you're done.

提交回复
热议问题