Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

gmanish's avatar

Connect to PostgreSQL Database using pgAdmin3

I've just gotten started with forge and have managed to deploy my app on a digital ocean server. However, I cannot seem to connect to the PgSQL database using pgAdmin3. I could not find anything in a google search.

Has anyone managed to connect to the database using pgAdmin3? Are there any other recommendations?

Here's what I'm using:

  • File->Add Server->New Server Registration Dialog:
    • SSH Tunnel Tab
      • Use SSH tunneling: true
      • Tunnel host: the server ip provided by forge
      • Tunnel Port: 22
      • Username: forge
      • Authentication: password
      • Password: password emailed to me

I am seeing the following error when I try to connect:

SSH error: Authentication by identity file failed with error code -16

I find this weird because I never tried connected through identity file. I'm using the password option.

If I use the "identity file" and supply the path to my public key @ ~/.ssh/id_rsa.pub, I get the same error.

Any help is appreciated (I hope you don't ask me to use the psql console :)

0 likes
5 replies
tykus's avatar

Is your public key in the server's authorized_keys?

gmanish's avatar

@tykus_ikus I'm able to ssh into the server from MacOSX terminal. So, I guess, it should be. I also added my public key into the SSH Keys section of "Server Details".

1 like
tykus's avatar
tykus
Best Answer
Level 104

Disclaimer I haven't used pgAdmin before and the following is untested, so take from this what you will...

From the pgAdmin docs, it appears you have to create the intermediary; from the commandline you can create a host thru which connections will be forwarded by: ssh -L [local port]:[database host]:[remote port] \ [username]@[remote host]

If you have a PostgreSQL installation on your local machine, it probably runs on the default port 5432 so you can't use this as the local port for the intermediary; use 5433 instead.

ssh -L 5433:your_forge_ip_addr:5432 forge@your_forge_ip_addr

Your pgAdmin connection is to localhost on the local port

1 like
ecomevo's avatar

Tried this solution here with pgAdmin 4 but unfortunately I get the error The connection to the server has been lost.

In my console where I created the SSH forward I get the error channel 3: open failed: connect failed: Connection timed out shortly after the pgAdmin error is displayed.

pgAdmin is on my Mac and Forge is on a fresh Ubuntu 16.04 EC2 instance.

Please or to participate in this conversation.