heroku DATABASE_URL
$ heroku config --app APP_NAME
(The Heroku toolbelt has been updated since the question was asked; the command now shows the entire DATABASE_URL
.)
$ heroku pg:credentials:url YOUR_DATABASE_NAME
Gives you all the informations needed (url, port, dbname, user, password):
Connection information for default credential.
Connection info string:
"dbname=xxxxxxxxxxxxxx host=yyyyyyyyyyyyyyyyyyyyyyyyyyy.amazonaws.com port=5432 user=zzzzzzzzzzzzzz password=************* sslmode=require"
Connection URL:
postgres://zzzzzzzzzzzzzz:*************@yyyyyyyyyyyyyyyyyyyyyyyyyyy.amazonaws.com:5432/xxxxxxxxxxxxxx