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

前端 未结 22 1943
梦谈多话
梦谈多话 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条回答
  •  伪装坚强ぢ
    2020-11-29 17:51

    If you are running Homebrew, uninstall Postgresql end pg gems:*

    $ gem uninstall pg
    $ brew uninstall postgresql
    

    Download and run the following script to fix permission on /usr/local:* https://gist.github.com/rpavlik/768518

    $ ruby fix_homebrew.rb
    

    Then install Postgres again and pg gem:*

    $ brew install postgresql  
    $ initdb /usr/local/var/postgres -E utf8
    

    To have launchd start postgresql at login run:

    $ ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents 
    

    Or start manually.

    Install pg gem

    $ gem install pg
    

    I hope have helped

提交回复
热议问题