Now that I've deployed my webapp to Heroku, how would I be able to browse the database as it's altered over time?
5 Answers
Try heroku pg:psql
. For instructions for how to do this, see this.
-
3I'm running Windows, and I installed PostgreSQL, however when I run that command, I get an error saying "The local psql command could not be located".– AndrewDec 5, 2013 at 21:28
-
If you read the link I provided, you'll see that it says you need to install postgres locally. It has instructions for doing so in Windows. Dec 5, 2013 at 21:49
-
1for running it on windows, you need to have Postgres installed locally and then you need to add the path to the bin folder of Postgres to the PATH environment variable. Once that is done, you should be able to run
heroku pg:psql
from powershell.– SumitApr 15, 2018 at 6:46 -
1@Andrew this Answer comes late but, add the path of psql.exe to your Windows environment variables. Feb 26, 2019 at 18:44
If you want to browse your Heroku PostgreSQL database using a browser there is now a free tool for that called Heroku Data Explorer: https://datazenit.com/heroku-data-explorer.html
It uses Heroku API in real time so your data/credentials stay secure and private. Also it has excellent performance because Heroku local network is used for database connections.
-
1
Download PgAdmin 4 and configure your heroku database credentials. Right click on Servers
link and choose create >> server
. On General
tab give Name
as per your wish and on Connection
tab enter Hostname/address, address, Maintenance database (database name), Username and password which is given in Heroku dabase credentials page. And you will be able to access heroku dadabase on UI free of cost.
-
1i was able to connect to the heroku pg database first time, now i want to connect again (after closing pgAdmin), it says
server closed the connection unexpectedly
. i know that heroku rotates credentials, so i tried to add a new server with current credentials, with no success.heroku pg:psql
fails too. any idea what could be wrong? Feb 8, 2022 at 18:24 -
I tried this, but pgAdmin 4 then shows a list of 6625 databases, none of which match what I entered into the server connection form.– RyanApr 19, 2022 at 18:45
-
The "Restrictions" was the answer for me: stackoverflow.com/a/15323270/470749– RyanApr 19, 2022 at 18:52
I use a tool called Adminer to connect to the DB. The problem is that Heroku will change the credentials for the DB occasionally. You can find them by visiting the Resources tab on your Dashboard then clicking on the DB you use.
It will take you to the Addons page in another tab. Click on the Settings tab then View Credentials.
Using these credentials, you can use Adminer to login to the DB.
-
I tried connecting to Heroku Postgresql using Adminer , it gives this error: Unable to connect to PostgreSQL server: FATAL: permission denied for database "postgres" DETAIL: User does not have CONNECT privilege. Could you please let me know what could be the problem here? Apr 25, 2020 at 20:35
-
Sorry i'm a bit late. Did you get your credentials from Heroku Postgres add-on page? When i get that, it's usually wrong credentials– NdetoApr 27, 2020 at 8:34
-
yes I did get the connection details but using Adminer not able to connect. So I chose the pgAdmin approach to connect to that database Apr 28, 2020 at 10:04