通过网络连接到PostgreSQL [英] connecting to PostgreSQL over a network

查看:159
本文介绍了通过网络连接到PostgreSQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个pgsql服务器运行在Windows 7.我可以远程连接到它在网络中使用计算机名称,所以我知道没有问题的配置等我已禁用防火墙。我有一个静态的ip,并试图从另一个网络连接到数据库,但我得到的错误:服务器不监听。我究竟做错了什么?我知道关于ip地址的小量,所以任何帮助将不胜感激。感谢提前!



编辑:
更多的信息,我已经设置了家庭网络,我有两个计算机联网在一起,可以访问pgsql服务器驻留在其中一台计算机上。我在英国,并从我的互联网从plusnet,配置都是在汤普森网关完成。第三台计算机是不在同一网络上的远程计算机,我只是测试,看看是否可以主机一个pgsql数据库的几个,而不是联网的计算机。它更多的是一个爱好的事情,真的,虽然如果我可以做的工作原因也可以。感谢您的帮助。 (对不起,如果我听起来很蠢,但这真的不是我的主题!)

解决方案

配置pg_hba.conf文件添加

 主机全部全部192.168.0.1/24 trust 

那IP 192.168.0.1只是为了举例,你会把你的IP
然后编辑postgresql.conf来反映这些设置

  tcpip_socket = true 




$ b $ b

默认情况下是localhost,put *来监听所有地址,或者只是你的IP来收紧安全性。


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!)

解决方案

Configure the pg_hba.conf file to add the line

host all all 192.168.0.1/24 trust

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

tcpip_socket = true 

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

这篇关于通过网络连接到PostgreSQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆