PostgreSQL error 'Could not connect to server: No such file or directory'

前端 未结 22 1911
梦谈多话
梦谈多话 2020-11-29 17:20

Like some others I am getting this error when I run rake db:migrate in my project or even try most database tasks for my Ruby on Rails 3.2 applications.

22条回答
  •  萌比男神i
    2020-11-29 18:03

    I had that problem when I upgraded Postgres to 9.3.x. The quick fix for me was to downgrade to whichever 9.2.x version I had before (no need to install a new one).

    $ ls /usr/local/Cellar/postgresql/
    9.2.4
    9.3.2
    $ brew switch postgresql 9.2.4
    $ launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
    $ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
    
    $ psql
    

    "Homebrew install specific version of formula?" offers a much more comprehensive explanation along with alternative ways to fix the problem.

提交回复
热议问题