Rails can't login to postgresql - PG::Error - password - Correct info

前端 未结 1 1638
抹茶落季
抹茶落季 2020-12-30 04:40

This is how my database.yml file looks (obviously there are relevant entries for testing and production as well)

development:
  adapter: postgresql
  encodin         


        
相关标签:
1条回答
  • 2020-12-30 05:23

    Database.yml:

    connection: &connection
      adapter: postgresql
      encoding: unicode
      pool: 5
      username: username
      password: tehpass
    
    development:
      <<: *connection
      database: dbname_development
    
    test:
      <<: *connection
      database: dbname_test
    
    production:
      <<: *connection
      database: dbname_production
    

    If this is not working for you then, there might be something wrong during installation.

    Visit this blog, hope this might help you out.


    EDIT


    ERROR CASE:

    e_sendauth: no password supplied 
    
    fe_sendauth: no password supplied
    

    This happens under a stock Ubuntu install, and is due to the permissions in pg_hba.conf being too restrictive by default. To allow rails to connect, simply change the bottom of pg_hba.conf to look like this.

    # TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
    
    # "local" is for Unix domain socket connections only
    local   all         all                               trust
    # IPv4 local connections:
    host    all         all         127.0.0.1/32          trust
    # IPv6 local connections:
    host    all         all         ::1/128               trust
    

    Let me know if this helps or not?

    0 讨论(0)
提交回复
热议问题