【问题标题】:How can stop Homebrew installing Postgres as root?如何阻止 Homebrew 以 root 身份安装 Postgres?
【发布时间】:2015-06-27 14:43:37
【问题描述】:

我有一个 Postgres 权限问题,每次我 brew install postgres 时,它都会以 root 用户身份执行,导致initdbcreatedb 和或我尝试的其他任何东西的权限被拒绝。

sudo chown 拥有 /usr/local/var/postgres 的所有权,它似乎发生了变化,并允许我从 cmd 行手动进入目录,该目录仅包含一个列出错误的 server.log 文件:

postgres cannot access the server configuration file "/usr/local/var/postgres/postgresql.conf": No such file or directory

然后我转到initdb 并返回:

The files belonging to this database system will be owned by user "jamesbkemp".
This user must also own the server process.

The database cluster will be initialized with locale "en_GB.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.

initdb: directory "/usr/local/var/postgres" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/usr/local/var/postgres" or run initdb
with an argument other than "/usr/local/var/postgres"

然后我返回查看/usr/local/var/postgres,并且所有者已更改回root。经过几个小时的了解,我真的很茫然。大家有什么想法吗?

【问题讨论】:

    标签: ruby database postgresql rvm homebrew


    【解决方案1】:

    以非 root 身份安装 Postgresql 很痛苦,因为它不是这样设计的:它是一个多用户服务。

    同样的事情:apache2 作为非 root 用户 - 您必须自己构建服务器并更改很多配置。

    让我补充一点,对于经验丰富的数据中心运营商来说,这是一个奇怪的想法,就像在你的公寓里驾驶赛车一样。

    【讨论】:

    • 哈哈哈,喜欢这个比喻@Str。你能建议一种方法来解决我似乎陷入的权限问题循环吗?
    • 在启动时,数据库进程无论如何都会更改为用户 postgres,恐怕你是死路一条。
    猜你喜欢
    • 2015-08-19
    • 2013-08-07
    • 1970-01-01
    • 2020-01-05
    • 2017-07-14
    • 2016-04-11
    • 2021-04-23
    • 2016-10-18
    • 1970-01-01
    相关资源
    最近更新 更多