# pg_ctl -D /var/lib/pgsql/data -l pglog.log start
server starting
postgres@linux-p0pl:~> 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"?
我不知道为什么在服务器启动时出现此错误...有人可以请帮忙。
我的pglog.log文件显示以下输出:
2013-02-06 19:43:39 GMT FATAL: lock file "postmaster.pid" already exists
2013-02-06 19:43:39 GMT HINT: Is another postmaster (PID 23971) running in data directory "/var/lib/pgsql/data"?
2013-02-06 19:44:02 GMT FATAL: lock file "postmaster.pid" already exists
2013-02-06 19:44:02 GMT HINT: Is another postmaster (PID 23971) running in data directory "/var/lib/pgsql/data"?
2013-04-24 12:43:29 GMT FATAL: data directory "/var/lib/pgsql/data" has group or world access
2013-04-24 12:43:29 GMT DETAIL: Permissions should be u=rwx (0700).
2013-04-24 12:44:07 GMT FATAL: data directory "/var/lib/pgsql/data" has group or world access
2013-04-24 12:44:07 GMT DETAIL: Permissions should be u=rwx (0700).
2013-04-24 12:57:02 GMT FATAL: data directory "/var/lib/pgsql/data" has group or world access
2013-04-24 12:57:02 GMT DETAIL: Permissions should be u=rwx (0700).
2013-04-24 12:57:40 GMT FATAL: data directory "/var/lib/pgsql/data" has group or world access
2013-04-24 12:57:40 GMT DETAIL: Permissions should be u=rwx (0700).
ps -ef | grep postgres
root 21659 21591 0 19:14 pts/0 00:00:00 grep --color=auto postgres
答案 0 :(得分:17)
/var/lib/pgsql/data
上的权限和所有权应为:
# ll -d /var/lib/pgsql/data
drwx------. 15 postgres postgres 4096 Apr 24 10:27 /var/lib/pgsql/data
如果他们不是以root身份做的话:
# chmod -R 700 /var/lib/pgsql/data
# chown -R postgres /var/lib/pgsql/data
答案 1 :(得分:1)
签入pglog.log
文件以确保服务器确实启动时没有错误。鉴于错误,它似乎无法正常启动。
答案 2 :(得分:1)
您可能没有将服务器配置为将unix域套接字放在“/ tmp”中。它可能在某个地方,比如“/ var / run / pgsql”,但请查看您的postgresql.conf
文件,看看到底是什么。
然后,您可以在命令行中将此目录指定为“主机”:
psql -h /path/we/want ...
如果不是问题,请检查端口号。
不确定你的psql客户端和postgresql服务器为什么/如何有不同的默认路径,但是我从来没有听说过你收到指令的网站,所以我不知道它们有多么有用。