I've just deployed my application to heroku and pointed my custom domain to the heroku servers. How can I check the records in my heroku database?
-
heroku help shows all you can do – apneadiving Apr 28 '11 at 21:47
10 Answers
You can use heroku run rails console
and look at your records with Model.all
or any other method.
If you want to backup the database look at heroku PG backups, you then can import your database on your local machine and look at it there. Depending on your db adapter you could use sqlite browser for sqlite3 or phpmyadmin for MySQL.

- 2,759
- 1
- 26
- 25
-
is there anything that can present the records in a more organized way? – Justin Meltzer Apr 28 '11 at 21:49
-
i added informations about tools to view the database locally. hope this helps! – Andre Schweighofer Apr 28 '11 at 21:57
-
1
-
8**Warning:** The `heroku run` command spins up a one-off dyno. Any time spent executing a one-off dyno will contribute to usage and will be charged just like any other dyno if you go over your monthly 750 free dyno-hours. – Dennis Apr 07 '14 at 19:14
I found a similar question like this and here is what @Chowlett says:
"You could run heroku pg:psql
to fire up a Postgres console, then issue \d
to see all tables, and \d tablename
to see details for a particular table."
You can also type select * from tablename;
to view the table contents.
How to view current database schema for Heroku app in Terminal?
heroku db:pull to pull your production DB locally to take a peek in it.

- 37,398
- 8
- 88
- 97
I'll give the method for connecting via a GUI tool
Run the following command to get the database credentials from Heroku:
heroku pg:credentials DATABASE_URL
Then you can use a GUI tool like PG Commander or PGAdmin to connect to the db

- 1,470
- 1
- 16
- 14
Heroku now has an add-on named PostgreSQL Studio (currently free & in beta) that would let you access your database from within the browser, without having to use CLI, much like PHP MyAdmin.
To attach this add-on to your application,
heroku addons:create pgstudio
Then go to the list of add-ons on Heroku, select PostgreSQL Studio, authorize it, select the database to connect with from the dropdown list of all databases and it will take you to the web-based interface to handle your selected database.
You may refer to this official article on Heroku: https://devcenter.heroku.com/articles/pgstudio

- 394
- 3
- 8
-
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Drenmi Nov 03 '15 at 06:26
-
-
This `pgstudio` is not available anymore. Any other solution new perhaps? Tried searching the whole Addons and no luck – Surveyor Jr Apr 02 '22 at 15:25
You can use heroku dataclips that allows to run queries online. Here you can find documentation https://devcenter.heroku.com/articles/dataclips.

- 358
- 2
- 8
Connect to the database using Sequel Pro. You can find your ClearDB url using heroku config
command. The structure for connecting is as follows:
CLEARDB_DATABASE_URL => mysql://[username]:[password]@[host]/[database name]?reconnect=true

- 18,052
- 30
- 105
- 150