簡體   English   中英

psql:錯誤:無法連接到服務器:沒有這樣的文件或目錄

[英]psql: error: could not connect to server: No such file or directory

我已經安裝了 Postgresql 並努力配置它,嘗試重新安裝但仍然面臨問題,我刪除了所有文件,然后安裝了 postgre 9.6 版本,但出現以下問題。

9.6 main    5432 down   postgres /var/lib/postgresql/9.6/main /var/log/postgresql/postgresql-9.6-main.log

當我嘗試使用 sudo -u postgres psql 運行 postgre 時,它在 output 以下給出

psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

我也嘗試過其他問題,但無法解決問題。

您的 PostgreSQL 客戶端很可能配置了與服務器不同的套接字目錄 ( /var/run/postgresql )。 檢查postgresql.conf中的unix_socket_directories配置參數。

服務器可能正在偵聽默認目錄/tmp 嘗試

psql -h /tmp ...

當然,也可能是服務器正在偵聽不同的端口,例如 5555(配置參數port )。 然后運行

psql -p 5555 ...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

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