我每次运行 Rails 应用程序时都会收到此错误(它无法连接到我的本地 Postgresql)
/Users/leonardo/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.11/lib/
active_record/connection_adapters/postgresql_adapter.rb:1208:in `initialize':
could not connect to server: No such file or directory (PG::Error)
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
我在用着Postgres.app http://postgresapp.com/它正在正确运行。
If I run
$ psql
我可以正确登录 Postgresql 控制台。
$ which psql
/Applications/Postgres.app/Contents/MacOS/bin/psql
Gemfile
source 'https://rubygems.org'
ruby "1.9.3"
gem 'rails', '3.2.11'
gem "pg"
数据库.yml
development:
adapter: postgresql
encoding: unicode
username: leonardo
password:
database: zapping
port: 5432
PostgreSQL(安慰)
$ psql
leonardo=# \l
尝试添加host: localhost
到您的database.yml。 (基于:https://stackoverflow.com/a/10793186/919641 https://stackoverflow.com/a/10793186/919641)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)