通过网络连接到 PostgreSQL
我有一个在 Windows 7 上运行的 pgsql 服务器。我可以使用计算机名称在网络内远程连接到它,所以我知道配置等没有问题。我已禁用防火墙。我有一个静态 IP,并尝试从另一个网络连接到数据库,但出现错误:服务器不监听。我做错了什么?我对 IP 地址了解很少,因此我们将不胜感激。提前致谢!
编辑: 更多信息,我已经建立了一个家庭网络,我有两台计算机联网在一起,它们都可以访问驻留在其中一台计算机上的 pgsql 服务器。我住在英国,从 plusnet 获取互联网,配置全部在 thompson 网关上完成。第三台计算机是不在同一网络上的远程计算机,我只是测试是否可以为多台非联网计算机“托管”pgsql 数据库。这实际上更像是一件最爱好的事情,尽管如果我也可以出于工作原因这样做的话。谢谢你的帮助。 (抱歉,如果我听起来很愚蠢,但这确实不是我的主题!)
I have a pgsql server running on windows 7. I can remotely connect to it within the network using the computer name, so i know that there are no issues with config etc. I have disabled firewall. I have a static ip and have tried to connect to the database from another network but i get the error: server does not listen. What am i doing wrong? I know small amounts about ip addresses so any help will be appreciated. thanks in advance!
EDIT:
A little more information, i have set up a home network, i have two computers networked together that can both access the pgsql server that resides on one of the computers. I am based in the uk and get my internet from plusnet, config is all done on the thompson gateway. The third computer is a remote computer not on the same network, i was just testing to see whether or not i could "host" a pgsql database for several, not networked computers. Its more of a hobbiest thing really, although would be could if i could do it for work reasons too. Thanks for you help. (sorry if i sound dumb but this really isnt my subject-yet!)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
配置 pg_hba.conf 文件以添加
IP 192.168.0.1 的行只是为了示例,您将把您的 IP 放在那里
然后编辑 postgresql.conf 以反映这些设置
我认为这 ^^ 仅适用于旧版本,但无论如何添加它
listen_addresses ='*'
默认情况下它是本地主机,输入 * 来监听所有地址,或者只是你的IP加强安全保卫
Configure the pg_hba.conf file to add the line
that IP 192.168.0.1 is just for the sake of example, you'll put there your IP
then edit the postgresql.conf to reflect these settings
i think this ^^ is only required for older versions, but add it there anyway
listen_addresses='*'
by default it's localhost, put * to listen to all addresses, or just your IP to tighten up the security