Connect to a heroku database with pgadmin

DatabasePostgresqlHerokuPgadmin

Database Problem Overview


I would like to manage my Heroku database with pgadmin client. By now, I've been doing this with psql. When I use data from heroku pg:credentials to connect de DB using pgadmin, I obtain:

> An error has occurred: > > Error connecting to the server: FATAL: permission denied for database > "postgres" DETAIL: User does not have CONNECT privilege.

How to achieve the connection?

Database Solutions


Solution 1 - Database

Open the "Properties" of the Heroku server in pgAdminIII and change the "Maintenance DB" value to be the name of the database you want to connect to.

pgAdmin III - New Server Registration

The default setup is suitable for DBAs et al who can connect to any database on the server, but apparently that isn't true in your case.

Solution 2 - Database

After you change the Maintenance DB name as suggested by araqnid's answer above, you should also add your database to the DB restrictions field because without this you will see thousands of databases and you may not be able to find yours in the list if the list is too long.

More details here - https://stackoverflow.com/questions/12663639/how-to-hide-databases-that-i-am-not-allowed-to-access/13298802#13298802

Solution 3 - Database

This is for pgAdmin 4

In order to connect pgAdmin to your database (postgres instance in Heroku), do the following:

  1. Login to Heroku, and select the application in which you have the database enter image description here

  2. Select the Resources tab and then click on "Heroku Postgres Ad-on" (see below). This will open up a new tab. enter image description here

  3. Select the Settings tab and then click on "View Credentials..." (see below) enter image description here

    You will get the following information that you will use in pgAdmin:

    enter image description here

  4. Go to pgAdmin, and create a new server enter image description here

  5. In the General tab, give a useful name enter image description here

  6. In the Connection tab, fill the info you got at Heroku enter image description here

  7. In order to avoid seeing thousands of databases, you need to add your database name to DB restriction in the Advanced tab (see below) enter image description here

Solution 4 - Database

We require SSL for connections outside Heroku. Please verify whether you're forcing SSL in your client.

Answered more thoroughly here: Connecting pgAdmin3 to Postgres on Heroku

We don't allow connections to the postgres database, so be sure to set Maintenance DB to your database name, and be sure to use SSL.

Solution 5 - Database

Change the Maintenance Database to the name of your Database, e.g. dva70000p0090. This should work.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionTomas RomeroView Question on Stackoverflow
Solution 1 - DatabasearaqnidView Answer on Stackoverflow
Solution 2 - Databasecm12View Answer on Stackoverflow
Solution 3 - DatabaselmiguelvargasfView Answer on Stackoverflow
Solution 4 - DatabasehgmnzView Answer on Stackoverflow
Solution 5 - DatabaseraviView Answer on Stackoverflow