This site runs best with JavaScript enabled.

SSH Tunnel in pgAdmin3 for PostgreSQL

SSH Tunnel in pgAdmin3 for PostgreSQL SSH Tunnel in pgAdmin3 for PostgreSQL

Photo by bantersnaps on Unsplash

I'm not afraid to admit, I'm a visual guy. I like GUI interfaces. Sequel Pro makes it very easy to SSH tunnel into a server and connect to MySQL, but there is nothing I have found built into pgAdmin3 to use SSH tunneling for connections.

Luckily I found it is simple enough to do.

First, open an ssh tunnel:

ssh -fNg -L 5555:localhost:5432 $YOUR_USERNAME@$YOUR_DOMAIN

This opens an SSH connection in the background mapping your local port 5555 to your server's port 5432 (Postgres' default port). Type "man ssh" to see what each of these flags is specifically doing.

Now, create a new connection in pgAdmin using localhost as your host and port 5555.

New pgAdmin Connection New pgAdmin Connection

Share article
Dustin Davis

Dustin Davis is a software engineer, people manager, hacker, and entreprenuer. He loves to develop systems and automation. He lives with his wife and five kids in Utah.