OSX Mavericks への最近のアップグレードにより、Rails アプリのデータベース接続が切断されました。
データベースから取得しようとすると、サーバーは次のエラーを返します。
PG::ConnectionBad (could not connect to server: Connection refused
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?
could not connect to server: Connection refused
Is the server running on host "localhost" (fe80::1) and accepting
TCP/IP connections on port 5432?
実行しようとすると、次のようpsql
になります。
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
私はインターネットで利用可能な多くのソリューションを試しました。pg gem を再インストールし、host: localhost を database.yml に設定します。/usr/local/var/postgres/pg_hba.conf ファイルには次のように書かれています。
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication RyanKing trust
#host replication RyanKing 127.0.0.1/32 trust
#host replication RyanKing ::1/128 trust
どの psql が返すか:/usr/local/bin/psql
これに関する解決策はありますか?いくつかの解決策は、Mavericks で新しいバージョンの postgres が追加されるため、$PATH を以前の postgres インストールに変更する必要があることを示唆しています。それがどこにあるかを見つけるにはどうすればよいですか?自作でインストールされた可能性は十分にありますが、確かではありません。