Postgres - 尝试rake db:create:all后无法连接到服务器

时间:2013-01-24 18:21:20

标签: database ruby-on-rails-3 unix homebrew postgres.app

我正试图在OS X Lion上运行Postgres - homebrew - rvm。

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

按照上述说明操作后,我遇到了同样的问题:

Repairing Postgresql after upgrading to OSX 10.7 Lion

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

好的,所以我修改了这样的路径(这就是文件中的所有内容):

source ~/.bash_profile

良好 - 正在运行which psql然后usr/local/bin/psql现在产生-d postgresql

然而 ,当我使用rake db:create:all作为数据库生成新的rails应用时,它会一直有效,直到我尝试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"? 结果为止在

{{1}}

有任何线索吗?

更新

我最终安装了Postgres.app:http://postgresapp.com/ - 这有效。

2 个答案:

答案 0 :(得分:1)

对于阅读此内容并使用Postgres.app的任何人,您可能需要在database.yml中使用host:localhost。 http://postgresapp.com/documentation#toc_3

答案 1 :(得分:1)

http://postgresapp.com将自己定义为“在Mac上开始使用PostgreSQL的最简单方法。只需下载,拖动到应用程序文件夹,然后双击”。它对我来说很完美。