PG::ConnectionBad: fe_sendauth: no password supplied

后端 未结 6 872
再見小時候
再見小時候 2020-12-04 18:59

When I attempt to run \"rake test\" on a local postgres database, it throws the above exception.

Here is my pg_hba.conf file: # Database administrative login by

6条回答
  •  悲哀的现实
    2020-12-04 19:51

    If your hb_conf has already been modified to force passwords, then make sure your rails app's database configuration includes a password in both development and test environments.

    default: &default
      adapter: postgresql
      encoding: unicode
      pool: 5
      host: localhost
      username: your_user
      password: your_password
    
    development:
      <<: *default
      database: your_db_development
    
    test:
      <<: *default
      database: your_db_test
    
    production:
      url: <%= ENV['DATABASE_URL'] %>
    

    I was getting this error when I failed to supply a password for the test database.

提交回复
热议问题