1

When I bundle exec rake RAILS_ENV=production db:migrate, I get:

rake aborted!
FATAL:  role "<USERNAME>" does not exist

Note that

$ psql  --username=<USERNAME> --dbname=<DATABASE> --password

Does work - which is quite different than the similar questions here.

Any idea what could be the problem ?

3
  • Odds are good your production configuration is not connecting to the same server as psql (your local server). Roles in Postgres are global, not database-specific. Commented Dec 4, 2013 at 18:23
  • @DanielLyons I double-checked even with --host=localhost (the same in database.yml). Could be two Postgres instances running on different ports ?! Commented Dec 4, 2013 at 18:26
  • 1
    Did you specify the port in database.yml? If so, try psql -p <portnum> Commented Dec 4, 2013 at 18:33

1 Answer 1

2

Thanks @DanielLyons for the head's up.

In fact, I was running two Postgres instances: one was being used by chef-server, on the default port 5432 and the "main one" on port 5433.

$ sudo netstat -plunt |grep postgres
  tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      571/postgres    
  tcp        0      0 127.0.0.1:5433          0.0.0.0:*               LISTEN      10030/postgres

I just added to my databases.yml file:

port: 5433

And it worked. (Note that this is a hotfix, until I get rid of the chef-server instance.)

Sign up to request clarification or add additional context in comments.

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.