13

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.

Community
  • 1
  • 1
szatan
  • 517
  • 4
  • 8
  • 26
  • 2
    i see `postfresql` as adaptor instead of `postresql`. is that a mistake ? could you please add the output of `ActiveRecord::Base.connection.instance_variable_get(:@config)` – Paritosh Piplewar Aug 09 '14 at 10:29
  • are you able to connect to postgres through commandline or pgadmin? – Sachin Singh Aug 12 '14 at 11:06
  • Try to connect specifying host: ```psql -U my_user -h localhost```. If it askes for password, then you should edit your ```pg_hba.conf``` again. – Timothy Kovalev Aug 20 '15 at 16:45

7 Answers7

3

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

Community
  • 1
  • 1
KJ_kaka
  • 241
  • 3
  • 10
3

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
2

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

RAILS_ENV=test rake db:setup
ussferox
  • 490
  • 5
  • 10
1

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

RAJ
  • 9,697
  • 1
  • 33
  • 63
0

Try supplying "empty" password using quotes:

password: ""
Luca B.
  • 638
  • 4
  • 13
0

no password supplied means that a password is required but you specified no password. Add the correct password to your database.yml file.

infused
  • 24,000
  • 13
  • 68
  • 78
0

if you don't want to specify authentication, try removing username: password: from the .yml file.

Som Poddar
  • 1,428
  • 1
  • 15
  • 22