Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rake db:setup results in fe_sendauth no password supplied

When I run: rake db:setup

i get:

fe_sendauth: no password supplied

Couldn't create database for {"adapter"=>"postfresql", "encoding"=>"unicode",
"host"=>"localhost", "pool"=>5, "username"=>"my_user", "password"=>nil,  
"database"=>"my_db_test"}

-- enable_extension("plpgqsl")
rake aborted


Tasks: TOP => db:schema:load

My database.yml:

connection: &connection
adapter: postgresql
encoding: unicode
host:     localhost
pool: 5
username: my_user
password:

development:
  <<: *connection
  database: my_db_development

test: &test
  <<: *connection
  database: my_db_test

Already change my pg_hba.conf like in this question: Trying to set up postgres for ror app, getting error - fe_sendauth: no password supplied But it not help at all.

like image 204
szatan Avatar asked Aug 06 '14 11:08

szatan


Video Answer


4 Answers

It's a database connectivity issue.

Try to connect directly with the database that ur using. If it is asking password then you should use same password in database.yml file.

Check this link http://guides.rubyonrails.org/configuring.html#configuring-a-postgresql-database and Ruby on Rails: How can i edit database.yml for postgresql?

Hoping this links help you

like image 77
KJ_kaka Avatar answered Nov 03 '22 10:11

KJ_kaka


My friend, I was have the same problem. My solution was added the credentials for each environment and enable the host in th value localhost..

like this:

development:
<<: *default
database: SM_development
username: user
password: xxxx

host: localhost

test:
<<: *default
database: SM_test
username: user
password: xxxxxx

production:
<<: *default
database: SM_production
username: user
password: xxxxxx
like image 45
Eduard Avendaño Avatar answered Nov 03 '22 10:11

Eduard Avendaño


try specifying which rails environment you want to do this for, like:

RAILS_ENV=test rake db:setup
like image 25
ussferox Avatar answered Nov 03 '22 08:11

ussferox


no password supplied means you have not supplied password to posgresql server from your database.yml.

Try to connect to posgresql server form pgadmin or terminal. Add same password (that you have used to login through terminal/pgadmin) to your database.yml.

Now try:

RAILS_ENV=TEST bundle exec rake db:setup

like image 24
RAJ Avatar answered Nov 03 '22 08:11

RAJ