簡體   English   中英

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

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

Ubuntu 14我在遠程服務器(digitalocean)上安裝了postgresql服務器。

運行命令psql並顯示錯誤:

postgres@ubuntu-512mb-fra1-01:/home/deploy$ psql
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_PAPER = "be_BY.UTF-8",
    LC_ADDRESS = "be_BY.UTF-8",
    LC_MONETARY = "be_BY.UTF-8",
    LC_NUMERIC = "be_BY.UTF-8",
    LC_TELEPHONE = "be_BY.UTF-8",
    LC_IDENTIFICATION = "be_BY.UTF-8",
    LC_MEASUREMENT = "be_BY.UTF-8",
    LC_TIME = "be_BY.UTF-8",
    LC_NAME = "be_BY.UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
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服務器,運行命令service postgresql start --force

* No PostgreSQL clusters exist; see "man pg_createcluster" 

我認為語言環境設置存在問題。 但是如何解決這個錯誤呢?

語言環境警告不會阻止psql連接。 閱讀有關此內容的https://askubuntu.com/questions/162391/how-do-i-fix-my-locale-issue

不存在PostgreSQL集群

意味着您可能沒有創建集群。 運行pg_createcluster -p 2345 9.5 test類的smth以創建測試集群,或者按照Ubuntu的建議更好地閱讀man pg_createcluster

走這邊

  • 查找集群

     pg_lsclusters 
  • 刪除集群(使用上面的信息)

     pg_dropcluster --stop 9.3 main 
  • 重新創建集群

     pg_createcluster --locale en_US.UTF-8 --start 9.3 main 
  • 登錄到postgres

     sudo -u postgres psql 
  • 並檢查語言環境

     show LC_COLLATE; show LC_CTYPE; 
  • -

暫無
暫無

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

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