更新 pg_hba.config 时如何在 Windows 10 中重新启动 postgresql 服务
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40458536/
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
how to restart postgresql service in windows 10 when updating pg_hba.config
提问by coder
please somebody tell me how to restart PostgreSQL service in windows 10 when updating pg_hba.config, and the steps to allow remote connections to a psql database please
请有人告诉我如何在更新 pg_hba.config 时在 Windows 10 中重新启动 PostgreSQL 服务,以及允许远程连接到 psql 数据库的步骤
回答by a_horse_with_no_name
You don't need to restart the service to activate changes done to pg_hba.conf
.
您无需重新启动服务即可激活对 所做的更改pg_hba.conf
。
All you need to do is to reloadthe configuration.
您需要做的就是重新加载配置。
Reload using a SQL statement
使用 SQL 语句重新加载
You can re-load all configuration files using a SQL statement, e.g. from within psql
- but any SQL client will do:
您可以使用 SQL 语句重新加载所有配置文件,例如从内部加载psql
- 但任何 SQL 客户端都可以:
select pg_reload_conf();
You must log-in to Postgres as a database super user (typically postgres
).
您必须以数据库超级用户(通常为postgres
)的身份登录 Postgres 。
Reload using pg_ctl
重新加载使用 pg_ctl
pg_ctl
can be used to signal a reload to the server
pg_ctl
可用于向服务器发出重新加载信号
pg_ctl reload -D \path\to\datadirectory
The data directory is the one you specifiedduring installation. If you don't know where the data directory is, use a SQL client and run show data_directory;
to find out.
数据目录是您在安装过程中指定的目录。如果不知道数据目录在哪里,可以使用SQL客户端运行show data_directory;
查找。
Restart the Windows service
重新启动 Windows 服务
If you do want to restart the service completely then do this as you would with any other Windows service through the control panel. Alternatively you can do that on the command line
如果您确实想完全重新启动该服务,请像通过控制面板使用任何其他 Windows 服务一样执行此操作。或者,您可以在命令行上执行此操作