Ana*_*and 9 postgresql macos ruby-on-rails ruby-on-rails-3 osx-lion
我正在使用MacOSX Lion,ruby 1.9.2,Rails 3.1.2和postgres 9.0.4
我做了一个rake db:使用postgres在我的应用程序上迁移.它因访问被拒绝错误而失败.
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:migrate
rake aborted!
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"?
Run Code Online (Sandbox Code Playgroud)
我已检查服务器是否正在运行且运行正常.我可以使用成功连接到我的数据库
psql -Umyuser myapp_development
psql -Umyuser myapp_test
Run Code Online (Sandbox Code Playgroud)
在创建新的PG用户时,它从未向我询问密码,因此我没有myuser在任何地方为该用户提供密码.
这是我的database.yml文件.
development:
adapter: postgresql
encoding: utf8
database: myapp_development
username: pgguy
test:
adapter: postgresql
encoding: utf8
database: myapp_test
username: pgguy
production:
adapter: postgresql
encoding: utf8
database: myapp_production
Run Code Online (Sandbox Code Playgroud)
我应该怎么做才能从我的rails应用程序连接到它?
Ana*_*and 24
添加host到我的database.yml文件解决了这个问题.
development:
adapter: postgresql
encoding: utf8
database: myapp_development
username: myuser
host: localhost
test:
adapter: postgresql
encoding: utf8
database: myapp_test
username: myuser
host: localhost
production:
adapter: postgresql
encoding: utf8
database: myapp_production
Run Code Online (Sandbox Code Playgroud)
我提到了这个线程的解决方案:升级到OSX 10.7 Lion后修复Postgresql
| 归档时间: |
|
| 查看次数: |
6656 次 |
| 最近记录: |