【问题标题】:Unable to use pg_ctl in Windows CMD?无法在 Windows CMD 中使用 pg_ctl?
【发布时间】:2020-12-05 16:28:17
【问题描述】:
pg_ctl status
pg_ctl: no database directory specified and environment variable PGDATA unset
Try "pg_ctl --help" for more information.

C:\Users\Think>pg_ctl --help
pg_ctl is a utility to initialize, start, stop, or control a PostgreSQL server.

不知道pg_data目录在哪里,我把C:\Users\Think\Desktop\postgres\data设置为用户变量系统变量中窗户设置。 但仍然无法正常工作。 bin目录下,有pg_ctl.exe文件。

【问题讨论】:

  • 你有没有读过pg-ctlPostgreSQL的文档,或者你认为阅读文档是浪费时间,你可以问别人如何使用PostgreSQL及其应用程序?

标签: postgresql cmd database-administration


【解决方案1】:

您需要使用-D 选项告诉pg_ctl 您的数据目录在哪里:

pg_ctl -D "Q:\path\to\datadir"

如果你已经创建了一个数据目录,你应该可以在cmd.exe中找到它

dir C:\ /s /b | find PG_VERSION

如果它在C:上。

如果你只是点击安装程序,它可能在

C:\Program Files\PostgreSQL\12\data

【讨论】:

    【解决方案2】:

    使用 pg_ctl 使用 postgresql 的 bin 目录路径。比如 root/.../../postgresql/bin/pg_ctl

    【讨论】:

    • 不是关于查找pg_ctl 可执行文件。
    猜你喜欢
    • 2018-10-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多