wilfra
wilfra

Reputation: 227

rake db:create:all => FATAL: password authentication failed for user "foo"

Trying to setup a postgresql db for the first time. I'm using this railscast. After many hours of frustrating issues, I got as far as rake db:create:all. Now I get the error:

password authentication failed for user "pgtest"

Here is my pg_hba.conf

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust

Here is my database.yml

development:
  adapter: postgresql
  encoding: unicode
  database: pgtest_development
  pool: 5
  username: pgtest
  password: password

test:
  adapter: postgresql
  encoding: unicode
  database: pgtest_test
  pool: 5
  username: pgtest
  password: password

I tried it first with no password and it gives the error:

fe_sendauth: no password supplied

What am I doing wrong? Thanks :)

Upvotes: 1

Views: 2581

Answers (1)

Chris Travers
Chris Travers

Reputation: 26464

if you just wrote changes to your pg_hba.conf and didn't RELOAD or RESTART PostgreSQL do that first. Those are common causes of what you describe.

If that didn't fix it, then you are either editing the wrong pg_hba.conf or you have rules specified earlier in the file that you aren't showing us. Rule out those cases in that order.

Upvotes: 1

Related Questions