添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

PostgreSQL:无法连接到服务器:域套接字"/var/run/postgresql/.s.PGSQL.5432"

1 人关注

Linux Mint. PostgreSQL 11.

我正在尝试:psql -U postgres

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"

In postgresql.conf:

   listen_addresses = '*'
   unix_socket_directories = '/var/run/postgresql'
   unix_socket_permissions = 0777

经过ps axf | grep postgres。

6575 ?        Sl     0:01          |       |   \_ xed /etc/postgresql/11/main/postgresql.conf
4906 pts/0    S      0:00          \_ sudo su postgres
4907 pts/0    S      0:00              \_ su postgres
6586 pts/0    S+     0:00                                      \_ grep --color=auto postgres
  root@andrej-HP-290-G1-SFF-Business-PC:/etc/postgresql/11/main# netstat -nltp | grep 5432
  root@andrej-HP-290-G1-SFF-Business-PC:/etc/postgresql/11/main# 

我是如何尝试治疗这个问题的。

  • ln -s /tmp/.s.PGSQL.5432 /var/run/postgresql/.s.PGSQL.5432

  • sudo find /tmp/ -name .s.PGSQL.5432

    结果。/tmp/.s.PGSQL.5432。 并在su下尝试:psql -U postgres

  • Running 'pg_lsclusters', I see:

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

    所以,状态是关闭的。但当我尝试 "pg_ctlcluster 11 main start "时,我收到了。

    Job for postgresql@11-main.service failed because the service did not 
    take the steps required by its unit configuration.
    See "systemctl status postgresql@11-main.service" and "journalctl -xe" 
    for details.
    

    正在执行 "journalctl -xe"。

     failed to create Unix-сокет in "/tmp
     system bd is switched-off
     failde to start server
      Can't open PID file /run/postgresql/11-main.pid (yet?) after start: 
      No such file or dir
      Failed with result 'protocol'.