psql: error: connection to server on socket "/var/pgsql/data/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
问题分析:
[postgres@localhost ~]$ cat /opt/postgresql/pgdata/postgresql.conf | grep unix_socket_directories
#unix_socket_directories = '/tmp' # comma-separated list of directories
解决方式:修改/opt/postgresql/pgdata/postgresql.conf文件中的unix_socket_directories参数
unix_socket_directories='/var/postgresql/pgdata' # 修改成自己的 pgsql 数据文件目录
# 重启服务
pg_ctl restart