[英]PG::ForeignKeyViolation: ERROR: update or delete on table and I don't know why in my case
[英]PG Error Don't know how to DEBUG
Exiting
/Users/judyngai/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.13/lib/active_record /connection_adapters/postgresql_adapter.rb:1216: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 "/tmp/.s.PGSQL.5432"?
我通读了一些帖子,有人建议添加
主机:localhost
到database.yml文件
然后我得到了这个新的错误
Exiting
/Users/judyngai/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.13/lib/active_record /connection_adapters/postgresql_adapter.rb:1216:in `initialize': could not connect to server: Connection refused (PG::Error)
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
有人可以指出我正确的方向吗?
我认为我没有提供足够的信息
当我做
psql --version
psql (PostgreSQL) 9.2.4
which psql
/usr/local/bin/psql
我的机器上确实安装了psql
这是我的database.yml文件
test:
adapter: postgresql
encoding: unicode
database: pinny_test
pool: 5
username: judyngai
password:
host: localhost
development:
adapter: postgresql
encoding: unicode
database: pinny_development
pool: 5
username: judyngai
password:
host: localhost
我没有评论生产部分。
看来您的PostgreSQL配置错误。 您需要在pg_hba.conf
更改配置。 您可以看到此答案https://stackoverflow.com/a/7696398/1405852
我假设您的database.yml
文件看起来像这样:
development:
adapter: postgresql
database: app_development
host: localhost
test:
adapter: postgresql
database: app_test
host: localhost
production:
adapter: postgresql
database: app_production
host: localhost
您需要安装并运行Postgres App 。 这是文档 。
让我知道您是否还有问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.