簡體   English   中英

PG錯誤不知道如何調試

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM