Connect to Heroku Postgres using SSH (Putty)

I would like to be able to connect to my Heroku postgres (tap) database from my desktop using Putty.

I recently moved from Webfaction to Heroku. In webfaction, this was a very simple process (via their docs: http://docs.webfaction.com/user-guide/databases.html#starting-an-ssh-tunnel-with-putty ).

Heroku allows you to retrieve database information and credentials using heroku pg:credentials . Shown here: https://devcenter.heroku.com/articles/heroku-postgresql#external-connections-ingress . I cannot figure out how to connect to the database through Putty using this information.

If I try to tune the situation with Heroku information, Putty will give this error: Disconnected: No supported authentication methods available.

+4
source share
3 answers

Heroku listens for SSL connections to the database, but does not provide a shell account as required by Putty. They say in their document :

When you find that you want to get SSH, try using tools that properly take into account the distributed Herokus environment, such as the heroku command-line tool and one-time dynodes.

Indeed, this contrasts with Webfaction , which clearly states that they offer shell access:

Full shell access for fast servers with all your favorite tools is pre-installed and supported for you.

Different companies, different services ...

+3
source

Use the following command literally: heroku pg:psql DATABASE

This will match the DATABASE_URL configuration line and connect you to your database using psql.

Note: you may need to add psql to your PATH

On Mac OS with PostGres:

export PATH=/Applications/Postgres.app/Contents/MacOS/bin:$PATH

+2
source

Heroku allows direct connection to databases, you do not need to use putty or another ssh client to tunnel on the database server.

Use your postgres credentials from Heroku to directly connect to psql from the command line.

0
source

Source: https://habr.com/ru/post/1483004/


All Articles