9

Postgres の Homebrew インストールで一般的な Mac OSX エラーが発生します。

No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

これは明らかに、システムに複数のインストールがあるためです。ただし、通常の手順では問題が解決されません。

Postgres と実行を正常に開始できます。

ps auxw | grep post

戻り値 ..

euanmillar       847   0.0  0.0  2432768    588 s000  R+   11:19am   0:00.00 grep postgres
euanmillar       845   0.0  0.0  2439324    448   ??  Ss   11:19am   0:00.00 postgres:
stats collector process
euanmillar       844   0.0  0.0  2443176   1520   ??  Ss   11:19am   0:00.00 postgres:
autovacuum launcher process
euanmillar       843   0.0  0.0  2443044    544   ??  Ss   11:19am   0:00.00 postgres: wal writer process
euanmillar       842   0.0  0.0  2443044    584   ??  Ss   11:19am   0:00.00 postgres: writer process
euanmillar       841   0.0  0.0  2443044    596   ??  Ss   11:19am   0:00.00 postgres: checkpointer process
euanmillar       839   0.0  0.0  2443044   3616 s000  S    11:19am   0:00.02 /us

postgres が実行されているようです。

postgresql.conf の次の行にコメントしました

port = 5432
unix_socket_directory = '/var/pgsql_socket'
unix_socket_permissions = 0777

そして var/pgsql_socket/ には隠しファイル .s.PGSQL.5432 があります

ここで多くの投稿の解決策を試しました。これは特に似ているようです:

https://dba.stackexchange.com/questions/21587/postgresql-is-running-locally-but-i-cannot-connect-why

しかし、違いは、すべての人に CHOWN された「/var/pgsql_socket」ディレクトリがあることです。Homebrew を使用して Postgres を完全に削除して再インストールしましたが、それでも同じ問題が発生します。

4

6 に答える 6

14

私にとっては、postmaster.pid を削除しました/usr/local/var/postgres。私を直してくれました。

于 2013-11-27T20:27:28.237 に答える
2

醸造バージョンではなく、システムクライアントが使用されています。symlink アプローチは、次の再起動までしか持続しません。このアプローチは、私が信じている根本的な問題を修正します

  1. 須藤編集/etc/paths
  2. を含む行を/usr/local/binファイルの先頭に移動します。(以前/usr/bin)
  3. postgres gem をアンインストールします ( gem uninstall pg)
  4. 新しいシェルを起動して、新しい環境設定をロードします
  5. bundle
于 2013-11-11T03:29:22.133 に答える
1

これは OS X 固有の問題ではありません。postgres インストールをクリーンアップしてから、再度インストールする必要があります。ubuntu 12.04でこの問題に直面しました。以前のインストールをクリーンアップする際に、postgres で始まるすべてのパッケージ (postgresql、postgresql-common、postgresql-client など)、つまり postgres* を削除する必要があります。私はbrewを使用していません.OS X Lionのポートを使用しています. 同等のコマンドはsudo brew remove postgres*. sudo brew install postgresql は、そのトリックを行う必要があります。

また、サーバーがすでに稼働していると思われる場合は、 を試すことができますsudo -u postgres createuser。それが失敗した場合は、再インストールする必要があります。

ただし、ps aux | grep post実際の出力は grep コマンドそのものです。実行中のpostgresサーバーではありません。

編集: 次のリンクが役立つようですhttps://dba.stackexchange.com/questions/21587/postgresql-is-running-locally-but-i-cannot-connect-why はいの場合、この質問は重複。

于 2013-06-21T17:03:27.380 に答える