如何在 Windows 中更改 postgresql 侦听端口?

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

how to change postgresql listening port in windows?

postgresqlport

提问by goh

How do i change the default listening port 5432 of postgresql to another number?

如何将 postgresql 的默认侦听端口 5432 更改为另一个数字?

Another question,

另一个问题,

What steps do i have do to allow remote r/w access to the database using python pyscopg2?

我需要执行哪些步骤来允许使用 python pyscopg2 远程 r/w 访问数据库?

回答by Frank Heikens

Just change the setting in the file postgresql.conf (can be found in the data directory):

只需更改文件 postgresql.conf 中的设置(可以在数据目录中找到):

port = 5433             # (change requires restart)

Remote access can be given by changing pg_hba.conf, just add the ip-address. You also have to edit postgresql.conf:

可以通过更改pg_hba.conf来提供远程访问,只需添加 ip-address。您还必须编辑 postgresql.conf:

listen_addresses = '*'