PG::ConnectionBad: fe_sendauth: no password supplied

后端 未结 6 867
再見小時候
再見小時候 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:53

    I use Postgres App. Which is really great because you don't have to supply username and password in the default part of the database.yml

    database.yml

    default: &default
      adapter: postgresql
      encoding: unicode
      pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
    
    development:
      <<: *default
      database: my-app_development
    
    test:
      <<: *default
      database: my-app_test
    
    production:
      <<: *default
      database: my-app_production
      username: my-app
      password: <%= ENV['MY-APP_DATABASE_PASSWORD'] %>
    

    My problem: I changed the path and wasn't able to get postgres to work.

    Solution: use the documentation to:

    1) Uninstall the app

    2) Stop the postgres process using this answer, which says to use sudo pkill -u postgres

    3) Reinstall and start the app

    Everything should work fine now, have a great day!

    Note: Doing this also solves the problem Postgres.app port 5432 in use

提交回复
热议问题