Reputation: 105
I have created Postgresql database locally. Postgre database
And here is my database.yml file. default: &default adapter: postgresql pool: 5 timeout: 5000
development:
<<: *default
database: myrubyblog
username: postgres
password: Naruto1994.
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: myrubyblog
username: postgres
password: Naruto1994.
production:
<<: *default
database: myrubyblog
username: postgres
password: Naruto1994.
I have made sure to enter correct password but I am still getting this error.
Upvotes: 3
Views: 884
Reputation: 404
You just need to add host: localhost
to each env. e.g.
development:
<<: *default
database: myrubyblog
host: localhost
username: postgres
password: Naruto1994.
Upvotes: 1
Reputation: 532
Messages like this indicate that you contacted the server, and it is willing to talk to you, but not until you pass the authorization method specified in the pg_hba.conf file.
Try this:
// set new password for user "postgres"
$sudo su postgres -c 'psql --username=postgres'
ALTER USER postgres with encrypted password 'your_password';
//change pg_hba.conf
local all postgres md5
then restart postgres.
This article might help you: Postgresql: password authentication failed for user "postgres"
Upvotes: 3
Reputation: 6253
you may add localhost, and makesure if you have password with dot or no dot (Naruto1994), and my suggestion split database name between each environment (development, test and production)
development:
adapter: postgresql
encoding: unicode
database: myrubyblog_development
host: localhost
username: postgres
password: Naruto1994.
pool: 5
test:
adapter: postgresql
encoding: unicode
host: localhost
database: myrubyblog_test
username: postgres
password: Naruto1994.
pool: 5
production:
adapter: postgresql
encoding: unicode
database: myrubyblog_production
pool: 5
host: localhost
username: #env_variable
password: #env_variable
Upvotes: 2