我已经安装了 PostgreSQL,但是当我postgres在 Windows CMD 中运行命令时
它给出以下错误:
postgres does not know where to find the server configuration file.
You must specify the --config-file or -D invocation option or set the PGDATA environment variable.
Run Code Online (Sandbox Code Playgroud)
即使在运行命令之后
initdb postgres维持类似的问题postgres -D C:\Program Files\PostgreSQL\data\
给了我以下输出:postgres does not know where to find the server configuration file.
You must specify the --config-file or -D invocation option or set the PGDATA environment variable.
Run Code Online (Sandbox Code Playgroud)
正如错误所说,要启动 postgresql 集群,您必须设置数据文件夹的路径。大概是这样的:
postgres -D "C:\Program Files\PostgreSQL\data\"
Run Code Online (Sandbox Code Playgroud)
但建议使用pg_ctl替代postgres:
pg_ctl -D "C:\Program Files\PostgreSQL\data\" start
Run Code Online (Sandbox Code Playgroud)
不要忘记查看有关如何启动服务器以及如何使用 pg_ctl的 postgres 文档。
通常,postgres 安装程序会创建一个服务/守护程序,因此不需要手动启动服务器。所以如果你得到这样的错误
Is another postmaster already running on port 5432?
Run Code Online (Sandbox Code Playgroud)
这可能意味着服务器已经在运行。尝试使用连接到它psql
| 归档时间: |
|
| 查看次数: |
12672 次 |
| 最近记录: |