Postgres - could not connect to server after trying rake db:create:all

孤街醉人 提交于 2019-12-11 05:46:17

问题


I'm trying to get Postgres up and running on OS X Lion - homebrew - rvm.

http://railscasts.com/episodes/342-migrating-to-postgresql

After following the above instructions, I ran into the same problem described here:

Repairing Postgresql after upgrading to OSX 10.7 Lion

Running which psql yieled usr/bin/psql when it should be usr/local/bin/psql

Ok, so I modified the path like this (this is all that is in the file):

export PATH="/usr/local/bin:$PATH"
[[ -s "/Users/chase/.rvm/scripts/rvm" ]] && source "/Users/chase/.rvm/scripts/rvm"

Good - running source ~/.bash_profile then which psql now yields usr/local/bin/psql

However, when I go generate a new rails app with -d postgresql as the database, it works up until I try rake db:create:all which results in

could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

Any clue?

UPDATE

I ended up installing the Postgres.app: http://postgresapp.com/ - this works.


回答1:


http://postgresapp.com defines itself as "The easiest way to get started with PostgreSQL on the Mac. Just download, drag to the applications folder, and double-click". It worked perfectly for me.




回答2:


For anyone reading this and using Postgres.app, you may need host: localhost in your database.yml. http://postgresapp.com/documentation#toc_3



来源:https://stackoverflow.com/questions/14508075/postgres-could-not-connect-to-server-after-trying-rake-dbcreateall

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!