linux – 连接psql时出现问题

我按照http://xadmin.info/?p=284中给出的说明安装了postgresql

# 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
最佳答案
/ 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

相关文章

linux常用进程通信方式包括管道(pipe)、有名管道(FIFO)、...
Linux性能观测工具按类别可分为系统级别和进程级别,系统级别...
本文详细介绍了curl命令基础和高级用法,包括跳过https的证书...
本文包含作者工作中常用到的一些命令,用于诊断网络、磁盘占满...
linux的平均负载表示运行态和就绪态及不可中断状态(正在io)的...
CPU上下文频繁切换会导致系统性能下降,切换分为进程切换、线...