Dhinakaran
Dhinakaran

Reputation: 845

rake db:create password authentication fails for user

While running the command rake db:create, the system throws postgresql authentication fails

FATAL:  password authentication failed for user "postgres"
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "username"=>"postgres", "password"=>"password", "timeout"=>5000, "host"=>"localhost", "database"=>"rails-sample-guestbook-master_development"}
rake aborted!

database.yml file

default: &default
  adapter: postgresql
  encoding: unicode
  pool: 5
  username: supranimbus
  password: 123456789
  timeout: 5000
  host: localhost
development:
  <<: *default
  database: rails-sample-guestbook-master_development

test:
  <<: *default
  database: rails-sample-guestbook-master_test

production:
  <<: *default
  database: rails-sample-guestbook-master_production

Upvotes: 0

Views: 1861

Answers (1)

fool-dev
fool-dev

Reputation: 7777

I guess the problem is setup password on postgresql if you don't remember the default password then go to pgAdmin click to open dashboard and then the left sidebar see the below image

enter image description here

Click the Properties... then will open a modal like see the below image

enter image description here

and click the Definition tab and see the Password field and set the new password, remember this password for postgres username.

That's is for password setup!

Now update your database.yml file like below

default: &default
  adapter: postgresql
  encoding: unicode
  username: postgres
  password: 123456 #=> which you set for postgres
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>

development:
  <<: *default
  database: project_development

Hope to help

Upvotes: 1

Related Questions