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

前端 未结 22 1917
梦谈多话
梦谈多话 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:12

    Hello world :)
    The best but strange way for me was to do next things.

    1) Download postgres93.app or other version. Add this app into /Applications/ folder.

    2) Add a row (command) into the file .bash_profile (which is in my home directory):

    export PATH=/Applications/Postgres93.app/Contents/MacOS/bin/:$PATH
    It's a PATH to psql from Postgres93.app. The row (command) runs every time console is started.

    3) Launch Postgres93.app from /Applications/ folder. It starts a local server (port is "5432" and host is "localhost").

    4) After all of this manipulations I was glad to run $ createuser -SRDP user_name and other commands and to see that it worked! Postgres93.app can be made to run every time your system starts.

    5) Also if you wanna see your databases graphically you should install PG Commander.app. It's good way to see your postgres DB as pretty data-tables

    Of, course, it's helpful only for local server. I will be glad if this instructions help others who has faced with this problem.

提交回复
热议问题