私はMacにPostgreSQLをインストールしました。psql
やcreatedb cool_database_name
のようなものを実行すると、次のエラーが発生します。インストール後にMac OS XでPostgreSQLに接続できませんでした
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"?
したがって、私はさまざまな解決策に従っています。 postgresqlを無償で再インストールします。 postgresql.conf`に行き、
#port = 5432 # (change requires restart)
#max_connections = 20 # (change requires restart)
# Note: Increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction).
#superuser_reserved_connections = 3 # (change requires restart)
#unix_socket_directory = '/var/pgsql_socket' # (change requires restart)
#unix_socket_group = '' # (change requires restart)
#unix_socket_permissions = 0777 # begin with 0 to use octal notation
に変更します。
ls -lA /var/run/postgresql
などのコマンドを実行すると、ファイルやディレクトリが存在しないことがわかります。
私もpg_hba.conf
ファイルにチェックしますが、すべては私がpsql -h localhost
を実行すると、私はこの問題を解決する方法についての失われたのだ
psql: 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?
を取得
# "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 jason trust
#host replication jason 127.0.0.1/32 trust
#host replication jason ::1/128 trust
OKに見えます。どんな助けもありがとう。
あなたは天才です。ありがとう! – jason328
私の場合、パスは '/ Applications/Postgres.app/Contents/Versions/9.4/bin'でした。 –
.dmgからpostgresをインストールし、 '/Library/PostgreSQL/9.5/bin'を参照しなければなりませんでした。 – Kim