Create an SSH tunnel for a remote Postgres database
2022.12.21
postgressshdatabase
Forward remote port 5432 to local port 5432:
ssh -p <ssh-port> -L 5432:localhost:5432 user@remote-server
Then connect locally as if Postgres were running on your machine:
psql -h localhost -U myuser mydb