【问题标题】:Postgres app error data directory in usePostgres 应用程序错误数据目录正在使用中
【发布时间】:2017-03-01 00:47:11
【问题描述】:

我是 postgres 新手,我通过下载 postgres 应用程序安装了它。但是,在删除应用程序后我不得不重新安装几次,现在由于某种原因,当我尝试通过单击“开始”来执行 postgres 时,我得到:

There is already a PostgreSQL server running in this data directory

所以,我实际上现在不知道该怎么做。我已经搜索了如何完全删除 postgres,但是由于我是通过下载 .dmg 文件进行安装的,所以我不知道除了删除应用程序文件夹中的应用程序并再次安装 dmg 文件之外还有什么要做的。我找到了一些关于卸载 postgres 的说明,但它们都是关于使用 brew 和 sudo 命令的,我认为这不适用于我的情况(因为我没有使用 pip install 或 brew install 安装)。

我已经重新安装了几次,但我仍然收到相同的消息,即已经有 PostgreSQL 服务器正在运行。我该如何解决这个问题?

我使用的是 Mac OS Sierra 10.12.2。

【问题讨论】:

    标签: macos postgresql


    【解决方案1】:

    来自故障排除指南: https://postgresapp.com/documentation/troubleshooting.html

    此数据目录中已经有一个 PostgreSQL 服务器在运行

    如果您已将 Postgres.app 配置为使用由不同 PostgreSQL 安装使用的数据目录,则可能会发生这种情况。 在启动 Postgres.app 之前停止其他服务器。 一般来说,不建议只使用另一个版本的 PostgreSQL 创建的数据目录,因为它可能配置不同。

    如果您想知道如何停止正在运行的其他 postgres 服务器,Mac 顶部栏中应该有一个小图标:

    如果存在,只需单击退出,它应该会停止它。

    此外,重新启动计算机通常会停止它。

    否则你可以试试:

    $  ps ux | grep Postgres
    scott 13272   0.0  0.0  2612628    304   ??  S    28Jan17   0:24.19 /Applications/Postgres.app/Contents/Versions/9.5/bin/postgres -D /Users/scott/Library/Application Support/Postgres/var-9.5 -p 5432
    scott 13268   0.0  0.1  2561100  10808   ??  S    28Jan17   0:10.94 /Applications/Postgres.app/Contents/MacOS/Postgres
    scott 75423   0.0  0.0  2434840    780 s011  S+    9:44PM   0:00.00 grep Postgres
    

    在 pid 上运行 kill(第二列,kill 13268 这里)应该会停止它。

    【讨论】:

      【解决方案2】:

      如果有人遇到同样的问题,而您的$ ps aux | grep postgres 没有告诉您有关通过另一个进程使用 postgres 目录的信息,只需使用您的 UI 应用程序重新启动 PostgreSQL,它看起来很简单,但对我有帮助;)

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-01-31
        • 1970-01-01
        相关资源
        最近更新 更多