Vì vậy, tôi đã cài đặt Postgresql lên máy Mac của mình và bất cứ khi nào tôi chạy bất cứ thứ gì như psql
hoặc createdb cool_database_name
tôi nhận được lỗi sau.Không thể kết nối với Postgresql trên Mac OS X sau khi cài đặt
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"?
Vì vậy, tôi làm theo các giải pháp khác nhau. Tôi cài đặt lại postgresql để không có kết quả. Tôi truy cập postgresql.conf` và thay đổi nó thành
#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
nhưng vẫn không có gì. Tôi chạy các lệnh như
ls -lA /var/run/postgresql
Cho tôi biết tệp hoặc thư mục không tồn tại.
Tôi cũng kiểm tra vào các tập tin pg_hba.conf
nhưng mọi thứ đều ok
# "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
Khi tôi chạy psql -h localhost
tôi nhận được
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?
Tôi đang ở một mất như thế nào để sửa lỗi này. Bất kỳ trợ giúp sẽ được đánh giá cao.
Bạn là một thiên tài. Cảm ơn! – jason328
Đối với tôi đường dẫn là '/ Applications/Postgres.app/Contents/Versions/9.4/bin' –
Tôi đã cài đặt postgres từ .dmg và phải tham khảo '/Library/PostgreSQL/9.5/bin' – Kim