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

前端 未结 22 1940
梦谈多话
梦谈多话 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 18:09

    So for a lot of the issues here, it seems that people were already running psql and had to remove postmaster.pid. However, I did not have that issue as I never even had postgres installed in my system properly.

    Here's a solution that worked for me in MAC OSX Yosemite

    1. I went to http://postgresapp.com/ and downloaded the app.
    2. I moved the app to Application/ directory
    3. I added it to $PATH by adding this to .bashrc or .bash_profile or .zshrc : export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
    4. I ran the postgres from the Applications directory and ran the command again and it worked.

    Hope this helps! Toodles!

    Also, this answer helped me the most: https://stackoverflow.com/a/21503349/3173748

提交回复
热议问题