El Capitan 上的 initdb /usr/local/var/postgres
initdb /usr/local/var/postgres on El Capitan
在 El Capitan 上通过自制软件安装 postgresql 9.5 后,我正在尝试 运行 initdb /usr/local/var/postgres
,但我得到以下信息:
The files belonging to this database system will be owned by user "kyledecot".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /usr/local/var/postgres ... initdb: could not change permissions of directory "/usr/local/var/postgres": Operation not permitted
尝试 cd /usr/local/var/postgres
我得到:
cd: permission denied: /usr/local/var/postgres
我似乎没有执行此操作的适当权限。我认为这与 El Capitan 的 System Integrity Protection 有关,但我可能错了。
我该如何解决这个问题?
sudo chown -R `whoami` /usr/local
我不得不将我看到的两条建议与 Stack Overflow 相关的问题结合起来 question/error。我发现自己处于先有鸡还是先有蛋的情况,我会重新安装 postgres 并一次更改一个权限,但是这两个命令相互冲突。
所以我这样做了:
sudo chown -R `whoami` /usr/local && brew postinstall postgresql
...而且效果很好。
我发现 chown
所有 /usr/local
目录并不是很有效和安全,所以我只是简单地做了
mkdir /usr/local/var/postgres
一切都很顺利。
在 El Capitan 上通过自制软件安装 postgresql 9.5 后,我正在尝试 运行 initdb /usr/local/var/postgres
,但我得到以下信息:
The files belonging to this database system will be owned by user "kyledecot".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /usr/local/var/postgres ... initdb: could not change permissions of directory "/usr/local/var/postgres": Operation not permitted
尝试 cd /usr/local/var/postgres
我得到:
cd: permission denied: /usr/local/var/postgres
我似乎没有执行此操作的适当权限。我认为这与 El Capitan 的 System Integrity Protection 有关,但我可能错了。
我该如何解决这个问题?
sudo chown -R `whoami` /usr/local
我不得不将我看到的两条建议与 Stack Overflow 相关的问题结合起来 question/error。我发现自己处于先有鸡还是先有蛋的情况,我会重新安装 postgres 并一次更改一个权限,但是这两个命令相互冲突。
所以我这样做了:
sudo chown -R `whoami` /usr/local && brew postinstall postgresql
...而且效果很好。
我发现 chown
所有 /usr/local
目录并不是很有效和安全,所以我只是简单地做了
mkdir /usr/local/var/postgres
一切都很顺利。