【问题标题】:init db error and postgresql not found after brew install postgresqlbrew install postgresql 后找不到 init db 错误和 postgresql
【发布时间】:2021-10-04 09:33:27
【问题描述】:

我正在尝试执行的命令:

pg_ctl init -D <path-to-db>

它给我的错误:

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

initdb: error: file "/opt/homebrew/Cellar/libpq/13.3/share/postgresql/postgres.bki" does not exist
This might mean you have a corrupted installation or identified
the wrong directory with the invocation option -L.
pg_ctl: database system initialization failed

当尝试“which postgresql”和“where postgresql”时,它会在此处给出“未找到”:

(base) aashishgangwani@Aashishs-MacBook-Pro ~ % which postgresql
postgresql not found
(base) aashishgangwani@Aashishs-MacBook-Pro ~ % where postgresql
postgresql not found

更新:我尝试过 brew reinstall postgres 它不起作用

【问题讨论】:

  • 在正常安装中,没有名为“postgresql”的可执行文件,因此它不在您的 PATH 中与您的问题无关。您的系统上是否有名为“postgres.bki”的文件?
  • @jjanes 是的,我确实在 /opt/homebrew/Cellar/postgresql/13.3/share/postgresql/postgres.bki 中找到了它,然后我将整个 postgres 文件夹复制粘贴到 libpq 目录中(/opt /homebrew/Cellar/libpq/13.3/share/) 所以我现在一切正常。

标签: postgresql macos homebrew


【解决方案1】:

我做了一些调试,发现我可能需要几个 postgres 文件到 libq 共享文件夹(/opt/homebrew/Cellar/libpq/13.3/share/),所以我复制粘贴了整个 postgres 目录(/opt/homebrew /Cellar/postgresql/13.3/share/postgresql)进入 libq 共享文件夹(/opt/homebrew/Cellar/libpq/13.3/share/)和pg_ctl init -D <path-to-db> 现在对我来说工作正常。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-09-30
    • 1970-01-01
    • 1970-01-01
    • 2023-02-15
    • 2018-01-03
    • 2021-08-11
    • 1970-01-01
    相关资源
    最近更新 更多