问题原文
原帖链接 · BryanWheelock · CC BY-SA 3.0
I installed Postgres 9.3 from the osX binary.
When I attempted to restart using pg_ctl restart, I received the following error:
$ pg_ctl restart
pg_ctl: could not open PID file "/Library/PostgreSQL/9.3/data/postmaster.pid": Permission denied
Bryan@bryans-mbp Fri Jun 13 13:41:24 ~
$ sudo ls -la /Library/PostgreSQL/9.3/data/postmaster.pid
Password:
-rw------- 1 postgres daemon 75 Jun 11 10:36 /Library/PostgreSQL/9.3/data/postmaster.pid
Who should own this file and what should the permissions be?
社区高分解答
原帖链接 · Eirik Toft · CC BY-SA 3.0
The permissions are correct as you want all of the data files and other associated stuff to be owned by the postgres user. I think the issue here is that the postgres daemon is not running as the postgres user.
To check which user the postgres daemon (postmaster) is running as, run:
Most *NIX (Like Solaris):
ps -ef | grep postgres
Linux
ps aux | grep postgres
Make sure that as root, you are running:
sudo -u postgres pg_ctl -D /Library/PostgreSQL/9.3/data start
Adjust the necessary paths for pg_ctl and sudo.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
