无法连接到PostgreSQL服务器:无法连接到服务器:权限被拒绝

无法连接到PostgreSQL服务器:无法连接到服务器:权限被拒绝

问题描述:

警告:pg_connect():无法连接到PostgreSQL服务器:无法连接到服务器:权限被拒绝服务器是否在主机"10.0.1.201"上运行并接受端口5432上的TCP/IP连接?

Warning: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: Permission denied Is the server running on host "10.0.1.201" and accepting TCP/IP connections on port 5432?

这是我尝试从基于linux的服务器连接到远程数据库时遇到的错误

This is the error i am getting when trying to connect to remote database from linux based server

尽管我能够从本地主机连接到它

Though i am able to connect to it from localhost

有人可以帮我吗

另一个适用于我的可能的方案/解决方案(针对同一问题)在这里:

One more possible scenario/solution that worked for me (for the very same problem) is here:

service httpd stop
service postgresql stop

setsebool -P httpd_can_network_connect 1

service httpd start
service postgresql start