Skip to content

Setting up a remote PostgreSQL connection

On ruachost.com, you can connect to your PostgreSQL databases remotely from your local computer. This allows you to manage data using client applications such as psql, pgAdmin, or programming libraries.

Before you can establish a remote connection, you must open a support ticket Provide:

  • The name of the PostgreSQL database you want to access remotely.
  • The database username.
  • The IP address from which you will connect.

Ruachost support will then enable remote access for your database.

An SSH tunnel encrypts traffic between your local computer and the PostgreSQL server.

  1. Download and open PuTTY.

  2. In Category → Connection → SSH → Tunnels, set:

    • Source port: 5432 (or another local port if 5432 is already in use).
    • Destination: localhost:5432.
    • Select Local and Auto.
    • Click Add.
  3. In Session, enter your server’s domain or IP, and set Port to 22 (or the custom SSH port, e.g., 7822).

  4. Save and open the session.

  5. Log in with your Ruachost username and password.

  6. Once connected, the tunnel is active. You can now use psql or pgAdmin locally with host localhost and port 5432.

Run in terminal:

Terminal window
ssh -p 7822 username@example.com -L 5432:localhost:5432
  • Replace 7822 with your SSH port if different.
  • Replace username and example.com with your Ruachost credentials.

You can connect directly to the PostgreSQL server if remote access is enabled.

  1. Open your PostgreSQL client (e.g., pgAdmin, psql).

  2. Enter the following connection details:

    • Host: yourserver.ruachost.com
    • Port: 5432
    • Database name: dbname
    • Username: dbuser
    • Password: dbpassword
Terminal window
psql -U dbuser -h yourserver.ruachost.com -p 5432 dbname