postgresql pgAdmin3 连接问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11171719/
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
pgAdmin3 connection problems
提问by Jez
I'm recently setting up and running a Windows 2008 r2 server with VMware Workstation 8.
我最近正在使用 VMware Workstation 8 设置并运行 Windows 2008 r2 服务器。
I'm running a Centos 6.2 virtual linux box with Postgresql 9.1. Everything seems ok locally and I can connect to the CentOS box via a bridged network connection.
我正在使用 Postgresql 9.1 运行 Centos 6.2 虚拟 linux 机器。本地似乎一切正常,我可以通过桥接网络连接连接到 CentOS 机器。
I have followed David Ghedini'swalkthrough for setting up Postgresql 9.1. So I am able to start a putty session window, log in as root and start psql shell and issue statements as postgres user. My problem is that I cannot connect using pgAdmin III from my Windows 7 client. I have updated the /var/lib/pgsql/9.1/data/postgresql.conf
to enable listen_addresses '*', etc.
我遵循了David Ghedini 的设置 Postgresql 9.1的演练。所以我能够启动一个腻子会话窗口,以 root 身份登录并启动 psql shell 并以 postgres 用户身份发出语句。我的问题是我无法从 Windows 7 客户端使用 pgAdmin III 进行连接。我已更新/var/lib/pgsql/9.1/data/postgresql.conf
以启用 listen_addresses '*' 等。
Could anyone give me any tips on finding my fault. Have ensured Windows Firewall is disabled on the Windows server, too.
任何人都可以给我任何关于找出我的错误的提示。确保在 Windows 服务器上也禁用了 Windows 防火墙。
The pgAdmin III client reports;
pgAdmin III 客户端报告;
'Server doesn't listen'
'服务器不听'
The server doesn't accept connections: the connection library reports
服务器不接受连接:连接库报告
could not connect to server: Connection timed out (0x0000274C/10060) Is the server running on host "192.168.1.26" and accepting TCP/IP connections on port 5432?
无法连接到服务器:连接超时 (0x0000274C/10060) 服务器是否在主机“192.168.1.26”上运行并接受端口 5432 上的 TCP/IP 连接?
This is the pg_hba.conf
file entry added:
这是pg_hba.conf
添加的文件条目:
#TYPE DATABASE USER ADDRESS METHOD
host all all 192.168.1.0/24 trust
And the iptables file entries added:
并添加了 iptables 文件条目:
-A INPUT -p tcp -s 0/0 --sport 1024:65535 -d 192.168.1.26 --dport 5432 -m state --state NEW,ESTABLISHED -j ACCEPT
-A OUTPUT -p tcp -s 192.168.1.26 --sport 5432 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT
采纳答案by Andrew
You need to adjust pg_hba.conf
:
你需要调整pg_hba.conf
:
http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html
http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html
Once you add your own host and corresponding user, restart postgresql server so hopefully you can connect.
添加自己的主机和相应的用户后,重新启动 postgresql 服务器,希望您可以连接。
Also you might need to enable it's port on the network: http://www.cyberciti.biz/tips/postgres-allow-remote-access-tcp-connection.html
您还可能需要在网络上启用它的端口:http: //www.cyberciti.biz/tips/postgres-allow-remote-access-tcp-connection.html
回答by jeswin
i have the same problem. I disabled all my third party antiviruses and firewalls and reinstall PostgreSQL again and its now working fine... :)
我也有同样的问题。我禁用了所有第三方防病毒软件和防火墙,然后再次重新安装了 PostgreSQL,现在工作正常... :)
回答by Bugalugs Nash
Make sure PostgreSQL Server is allowed through the firewall:
确保允许 PostgreSQL 服务器通过防火墙:
On the server machine, go to
在服务器机器上,转到
Control Panel > System and Security > Windows Firewall > Allow an app through Windows Firewall
控制面板 > 系统和安全 > Windows 防火墙 > 允许应用程序通过 Windows 防火墙
Scroll through Allowed apps and features, make sure 'PostgreSQL Server' is checked.
滚动允许的应用程序和功能,确保选中“PostgreSQL 服务器”。
回答by Lei Chi
Probably a firewall issue, check it by
可能是防火墙问题,检查一下
systemctl status firewalld.service
you could simply disable it by:
您可以简单地通过以下方式禁用它:
systemctl stop firewalld.service
systemctl disable firewalld.service
回答by kgrittn
Is the server running on host "192.168.1.26" and accepting TCP/IP connections on port 5432?
服务器是否在主机“192.168.1.26”上运行并接受端口 5432 上的 TCP/IP 连接?
Check that the server has that IP address. Check that there are postgres
processes running. Use netstat to confirm that the server is listening on port 5432.
检查服务器是否具有该 IP 地址。检查是否有正在postgres
运行的进程。使用 netstat 确认服务器正在侦听端口 5432。