postgresql - 无法在 Windows CMD 中使用 pg_ctl?
问题描述
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 目录在哪里,我在 windows 设置中将 C:\Users\Think\Desktop\postgres\data 设置为用户变量和系统变量。但仍然无法正常工作。在bin目录下,有 pg_ctl.exe 文件。
解决方案
您需要使用该-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
推荐阅读
- github - 只允许 PR 作者或管理员合并到受保护的主分支
- python - 将日期作为 pandas 数据框列名进行交互
- reactjs - JSX 属性建议在 VSCode 中不起作用
- android - 我找不到用于减少在 android studio 中的布局上创建的按钮的按钮
- r - R将excel与不兼容的列结合起来
- python - 将熊猫数据框转换为自定义字典
- sql - 如何使用列作为参数将表与其他表分开
- npm - package.json bundledDependencies 来自本地包
- c - 从 Windows 设备上的 USB 驱动器自动运行
- amazon-web-services - Redshift Data API 查询语句大小限制为 100 KB