在psql进入数据库出现以下错误
[postgres@pg data]$ psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
可能出现的原因1:
tmp目录的全权限被修改过
[root@pg ~]# chown -R postgres:postgres /tmp
可能原因2:
修改过以下参数
unix_socket_directories = '/home/postgres/' # comma-separated list of directories
# (change requires restart)
unix_socket_group = '' # (change requires restart)
unix_socket_permissions = 0777 # begin with 0 to use octal notation
更改过存放文件的位置目录(默认是tmp)
重启数据库后psql进入数据库出现开始的错误
这是我们有几个方法进入数据库
一个是指定文件的位置
[postgres@pg data]$ psql -h /home/postgres/
psql (9.4.4)
Type "help" for help.
postgres=#
另一个是指定主机
[postgres@pg data]$ psql -h 127.0.0.1
psql (9.4.4)
Type "help" for help.
postgres=#
有时候如果你不小心删除了wal日志,导致数据库无法读取wal日志也会出现这种错误,这时候如果你开启了归档还好办,没有话,只能重装数据库了。
postgresql出现Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.
最新推荐文章于 2025-03-26 15:29:39 发布