加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

postgresql – Psql无法连接到服务器:没有这样的文件或目录,543

发布时间:2020-12-13 16:35:21 所属栏目:百科 来源:网络整理
导读:我正在尝试在我的Vagrant机器上运行psql,但是我收到此错误: psql: could not connect to server: No such file or directoryIs the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"? 注意:V
我正在尝试在我的Vagrant机器上运行psql,但是我收到此错误:
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"?

注意:Vagrant 1.9.2
Box:ubuntu / trusty64,https://atlas.hashicorp.com/ubuntu/boxes/trusty64

编辑
我用来安装和运行postgres的命令:

> sudo apt-get update
> sudo apt-get install postgresql
> sudo su postgres
> psql -d postgres -U postgres

我遇到了同样的问题,与我的pg_hba.conf文件(位于/etc/postgresql/9.6/main)的配置有关.请注意9.6不是我正在使用的postgresql版本.

错误本身与postgresql的配置错误有关,导致服务器在启动之前崩溃.

我建议按照这些说明操作:

>使用sudo service postgresql start证明postgresql服务正在运行
>从终端运行pg_lsclusters
>检查您正在运行的群集是什么,输出应该是这样的:

版本 – 群集端口状态所有者数据目录

9.6 ——- main – 5432在线postgres /var/lib/postgresql/9.6/main

Disregard the ‘—‘ signs,as they are being used there only for alignment.
The important information are the version and the cluster. You can also check whether the server is running or not on the status column.

>从版本和群集中复制信息,并使用如下:
pg_ctlcluster< version> <簇GT;开始,所以在我的情况下,使用版本9.6和集群’main’,它将是pg_ctlcluster 9.6主要开始
>如果出现问题,那么postgresql将生成一个日志,可以在/var/log/postgresql/postgresql-u0026lt;versionu0026gt;-main.log上访问,因此在我的情况下,完整的命令将是sudo nano / var /log/postgresql/postgresql-9.6-main.log.
>输出应显示错误是什么.

2017-07-13 16:53:04 BRT [32176-1] LOG: invalid authentication method “all”

2017-07-13 16:53:04 BRT [32176-2] CONTEXT: line 90 of configuration file “/etc/postgresql/9.5/main/pg_hba.conf”

2017-07-13 16:53:04 BRT [32176-3] FATAL: could not load pg_hba.conf

>修复错误并通过sudo service postgresql restart重新启动postgresql服务,它应该没问题.

我已经搜索了很多来找到这个,功劳归到了这个post.

祝你好运!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读