升级到OS X Lion后的PostgreSQL权限问题 [英] PostgreSQL permissions issue after upgrading to OS X Lion
问题描述
升级到Lion后,尝试启动Postgres服务器时出现以下错误:
After upgrading to Lion, I get the following error when trying to start up the Postgres server:
pg_ctl:无法打开PID文件 /usr/local/var/postgres/postmaster.pid:权限被拒绝
pg_ctl: could not open PID file "/usr/local/var/postgres/postmaster.pid": Permission denied
我也试图重新运行initdb命令,但遇到类似的问题:
I also tried to re-run the initdb command, but ran into a similar problem:
initdb:无法访问目录 / usr / local / var / postgres:权限被拒绝
initdb: could not access directory "/usr/local/var/postgres": Permission denied
如果重要的话,PostgreSQL是通过Homebrew安装的。运行 brew info postgresql
会产生预期的结果(版本,摘要文档)。
If it matters, PostgreSQL was installed via Homebrew. Running brew info postgresql
yields the expected results (version, summarized docs).
推荐答案
嗯,事实证明,解决方案非常简单。我将/ usr / local / var上的组更改为staff(从wheel),并将所有权( chown -R
)更改为我的系统帐户(从root)。
Well, it turns out the solution was pretty simple. I changed the group on /usr/local/var to staff (from wheel) and changed the ownership (chown -R
) to my system account (from root).
在那之后,postgres开始正常工作。
After that, postgres started up fine.
我对更改这些权限有些紧张,但是唯一的我的/ usr / local / var是一个postgres目录,所以一切应该都很好。如果/ usr / local / var中还有其他目录/文件,也许在加冕时不使用 -R
标志?
I was a little nervous changing those permissions, but the only thing in my /usr/local/var was a postgres directory, so all should be well. If you have other directories/files in /usr/local/var, maybe don't use the -R
flag when chown'ing?
Homebrew ruby安装程序脚本将/ usr / local / var组更改为staff,因此升级到Lion时必须撤消该操作。不确定所有权是root而不是我的系统帐户...
The Homebrew ruby installer script changes the group of /usr/local/var to staff, so that must have gotten undone when upgrading to Lion. Not sure about the ownership being root instead of my system account though...
这篇关于升级到OS X Lion后的PostgreSQL权限问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!