如何在 OS X 上重新启动 postgresql?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42344890/
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-09-09 06:23:41  来源:igfitidea点击:

How to restart postgresql on OS X?

macospostgresql

提问by Abhas Sinha

Can't find how to restart postgresql on OS X using command line in order to apply changes in pg_hba.conf. I'v tried various command from web and docs. How to do it right?

找不到如何使用命令行在 OS X 上重新启动 postgresql 以应用 pg_hba.conf 中的更改。我尝试了来自网络和文档的各种命令。怎么做才对?

EDIT:Response of attempt to find the path looks this way:

编辑:尝试查找路径的响应如下所示:

TheKotik       73454   0.0  0.0  2619360    804   ??  S     7:20PM   0:01.57 /Applications/Postgres.app/Contents/Versions/9.6/bin/postgres -D /Users/TheKotik/Library/Application Support/Postgres/var-9.6 -p 5432

采纳答案by Aziz Javed

pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log restart

/usr/local/var/postgresis the location of the database storage area, and /usr/local/var/postgres/server.logis my log file for postgres. The last word restartis the operative word here. You can also use startto start the service.

/usr/local/var/postgres是数据库存储区的位置,/usr/local/var/postgres/server.log是我的postgres日志文件。最后一个词restart是这里的有效词。也可以使用start来启动服务。

You can find the location of the database storage area by running ps aux | grep postgres | grep -- -D

您可以通过运行找到数据库存储区的位置 ps aux | grep postgres | grep -- -D

回答by Abhas Sinha

Just in case postgres has been installed using homebrew, you can also run below command:

以防万一已使用自制软件安装了 postgres,您还可以运行以下命令:

brew services restart postgres

回答by Vao Tsun

for hba.confchanges to apply you don't need to restart - just reload.

对于hba.conf更改应用于您不需要重启-刚刚重装。

run select pg_reload_conf()in psql

select pg_reload_conf()在 psql 中运行

also:

还:

run show data_directoryin psql to find your data dir...

show data_directory在 psql 中运行以查找您的数据目录...