postgresql pg_ctl:未指定数据库目录且未设置环境变量 PGDATA

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44762526/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 02:35:22  来源:igfitidea点击:

pg_ctl: no database directory specified and environment variable PGDATA unset

sqlpostgresql

提问by chrisgk

when I run the command: pg restart on windows 10 i take the below error: pg_ctl: no database directory specified and environment variable PGDATA unset

当我在 Windows 10 上运行命令:pg restart 时出现以下错误:pg_ctl:未指定数据库目录且环境变量 PGDATA 未设置

回答by VynlJunkie

You need to specify where the database directory is installed to.

您需要指定数据库目录的安装位置。

eg

例如

pg_ctl restart -D [insert directory location here]

Failing that you will need to set the environment variable PGDATA. Something like

如果失败,您将需要设置环境变量 PGDATA。就像是

 set $PGDATA = [directory location here]