Postgres cannot connect to server on Unix domain socket 5432

后端 未结 2 1638
轻奢々
轻奢々 2021-01-15 23:29

Using Postgres 9.2.2, I keep getting this error when I try to start up rails server or run psql

could not connect to server: No such file or dir         


        
相关标签:
2条回答
  • 2021-01-15 23:51

    I saw this issue arise again once more with someone who actually had Postgres.app installed. Though, it's unclear why his threw this error because I've never seen it before with Postgres.app.

    The solution was changing the database.yml file from:

    development: &default
      adapter: postgresql
      database: myapp_development
      encoding: utf8
      min_messages: warning
      pool: 5
      timeout: 5000
    
    test:
      <<: *default
      database: myapp_test
    

    To:

    development: &default
      adapter: postgresql
      database: myapp_development
      encoding: utf8
      min_messages: warning
      pool: 5
      timeout: 5000
      host: localhost
    
    test:
      <<: *default
      database: myapp_test
    

    Only difference is the "host" line

    0 讨论(0)
  • 2021-01-16 00:08

    Screw it. I just installed Postgres.app by Heroku. No more messy issues.

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