【问题标题】:Postgresql: could not connect to server: No such file or directoryPostgresql:无法连接到服务器:没有这样的文件或目录
【发布时间】:2016-12-01 08:19:09
【问题描述】:

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" 

我认为语言环境设置有问题。但是如何解决这个错误呢?

【问题讨论】:

标签: postgresql ubuntu ubuntu-14.04 digital-ocean


【解决方案1】:

语言环境警告不会阻止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

【讨论】:

    【解决方案2】:

    往这边走

    • 找到集群

      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;
      
    • -

    【讨论】:

      猜你喜欢
      • 2017-11-29
      • 1970-01-01
      • 2015-12-24
      • 1970-01-01
      • 2021-04-08
      • 2018-01-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多