Ruby on rails Postgresql Rails的问题

Ruby on rails Postgresql Rails的问题,ruby-on-rails,postgresql,Ruby On Rails,Postgresql,我在跑步时遇到问题: rake db:create:all 我目前有: $ psql --version psql (PostgreSQL) 9.3.0 $ which psql /Applications/Postgres.app/Contents/MacOS/bin/psql 并获得: $ rake db:create:all could not connect to server: Permission denied Is the server running locally

我在跑步时遇到问题:

rake db:create:all
我目前有:

$ psql --version
psql (PostgreSQL) 9.3.0

$ which psql
/Applications/Postgres.app/Contents/MacOS/bin/psql
并获得:

$ rake db:create:all
could not connect to server: Permission denied
    Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
/Users/stephanecedroni/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgresql_adapter.rb:1222:in `initialize'
/Users/stephanecedroni/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgresql_adapter.rb:1222:in `new'
/Users/stephanecedroni/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgresql_adapter.rb:1222:in `connect'
/Users/stephanecedroni/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgresql_adapter.rb:324:in `initialize'
/Users/stephanecedroni/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `new'
/Users/stephanecedroni/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `postgresql_connection'
/Users/stephanecedroni/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
/Users/stephanecedroni/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
.....
.....
试图卸载并重新安装
pg
gem,但仍然无法工作

首先尝试跟随Ryan Bates的剧集,但遇到了一些问题,然后检查Heroku Postgres建议设置此路径:


PATH=“/Applications/Postgres.app/Contents/MacOS/bin:$PATH”

可能是rake试图连接到
/var/pgsql\u socket/.s.pgsql.5432
,但域套接字实际上在其他地方。我的地址是
/tmp/.s.PGSQL.5432
。你可以试试这些:

在database.yml中指定
host:localhost
。例如:

development:
  host: localhost
  # other stuff

/var/pgsql\u socket/
中创建一个符号链接,指向
.s.pgsql.5432
实际存在的位置

mkdir /var/pgsql_socket
ln -s /tmp/.s.PGSQL.5432 /var/pgsql_socket/.s.PGSQL.5432
你可能还需要浏览和修改链接。我不确定是否也要链接.s.PGSQL.5432.lock


第一种选择要简单得多。不确定其中一个更好。

我以前也有类似的问题。您是如何安装Postgresql的?你的database.yml看起来像什么?谢谢你的回复。在Postgres网站上下载。在RyanBates的屏幕播放后,尝试用自制软件安装它。。并且使用相同的数据库。yml开发:适配器:postgresql编码:unicode数据库:blog_开发池:5用户名:blog密码:您一定是对的,当我运行postgres并在psql控制台中检查\connfo时,我得到:您通过端口“5432”处的“/tmp”中的套接字以用户“Stephaneedroni”的身份连接到数据库“Stephaneedroni”您将如何更改您的域套接字?不知道如何实际创建符号链接..Thx为您提供帮助请先尝试
host:localhost
选项,这样更容易。如果需要更多帮助,请发回。