无法在mac 10.8.5上启动psql(postgres)

时间:2015-01-24 07:31:47

标签: database postgresql psql

这是我尝试从控制台访问psql时得到的内容。我正在使用自制软件来运行postgres。

atul-new-mac:sites user$ 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"?

我检查了这个版本:

atul-new-mac:sites user$ which psql
/usr/local/bin/psql

以下是日志文件中的详细信息:

atul-new-mac:sites user$  tail -f /usr/local/var/postgres/server.log
ERROR:  could not access status of transaction 0
DETAIL:  Could not open file "pg_clog/0000": Permission denied.
LOG:  received smart shutdown request
LOG:  autovacuum launcher shutting down
LOG:  shutting down
PANIC:  could not open control file "global/pg_control": Permission denied
LOG:  checkpointer process (PID 381) was terminated by signal 6: Abort trap
LOG:  terminating any other active server processes
LOG:  could not open temporary statistics file "pg_stat/global.tmp":            Permission denied
LOG:  abnormal database system shutdown

这是我尝试手动启动时的结果:

atul-new-mac:postgres user$ pg_ctl -D /usr/local/var/postgres -l     /usr/local/var/postgres/server.log start
pg_ctl: another server might be running; trying to start server anyway
server starting
sh: /usr/local/var/postgres/server.log: Permission denied

1 个答案:

答案 0 :(得分:1)

您的日志告诉您的postgresql实例遇到权限问题(行ERROR和PANIC)并读取您提供的其他摘录,您可能已经运行了postgresql实例。

要检查它,只需执行以下命令:

ps aux | grep -i "*postgres*"

您应该看到所有postgresql进程都在运行。

尝试通过使用pg_ctl stop停止所有thoses进程,或者如果没有任何反应并且进程仍在那里,那么尝试杀死它们(我认为你是在开发平台上,所以不应该导致问题对于其他人)

kill -9 <postgresID>

然后当所有的postgresql进程都消失了,然后尝试启动postgresql。如果您仍然遇到权限问题use lsof tool to see which process is locking your files