4

I am trying to get a rails app to work with heroku but I am doing something wrong.

Database.yml

   development:
    adapter: postgresql
    encoding: unicode
    database: (heroku db)
    user: (heroku db_user)
    pool: 5
    password: (heroku db_pass)

If I enter the information from my heroku database I get:

PG::ConnectionBad FATAL: password authentication failed for user

1
  • What are you trying to do? Why are you putting your heroku database information into your development database? Commented Mar 20, 2014 at 3:46

2 Answers 2

3

I am not rails guy, But this is something that i have done just now on my spring app, I wanted to connect my localhost development to heroku db.. I got db info from this:

heroku pg:credentials DATABASE

then I have passed params.. But I found that to connect remote heroku db, I needed to add this to my connection params..

ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory
Sign up to request clarification or add additional context in comments.

1 Comment

The old kerouku command has changed to heroku pg:credentials:url DATABASE --app app-name
0

I guess, you also need to specify the host and port. To find out the host try running this command:

$ heroku config | grep HEROKU_POSTGRESQL

You should see something like

HEROKU_POSTGRESQL_RED_URL: postgres://user3123:[email protected]:6212/db982398

if you already added the PostgreSQL add-on. More on this read here.

Then add the host and port info to your configuration:

development:
  ...
  host: ec2-117-21-174-214.compute-1.amazonaws.com
  port: 6212
  ...

But do remember that it's a bad idea to work with the production database from your local dev machine, unless you really know what you are doing.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.