Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql pgAdmin III:对数据库的访问被拒绝_Postgresql - Fatal编程技术网

Postgresql pgAdmin III:对数据库的访问被拒绝

Postgresql pgAdmin III:对数据库的访问被拒绝,postgresql,Postgresql,我正在尝试从连接到远程数据库。我已经创建了一个“新服务器注册”。当我连接到数据库时,我得到“拒绝访问数据库” 我把一切都安排好了。以下是我的PostgreSQL设置: pg_hba.conf> PostgreSQL客户端身份验证配置文件 postgresql.conf>我允许所有输入连接侦听地址='*' 使用SSH,我可以连接到数据库: [fuiba@test]$ psql -h localhost -p 26888 -d postgres psql (9.1.11) Type "he

我正在尝试从连接到远程数据库。我已经创建了一个“新服务器注册”。当我连接到数据库时,我得到“拒绝访问数据库”

我把一切都安排好了。以下是我的PostgreSQL设置:

  • pg_hba.conf>
PostgreSQL客户端身份验证配置文件

  • postgresql.conf>我允许所有输入连接
    侦听地址='*'
使用SSH,我可以连接到数据库:

[fuiba@test]$ psql -h localhost -p 26888 -d postgres
psql (9.1.11)
Type "help" for help.

postgres=# \l
                             List of databases
     Name     |  Owner  | Encoding | Collate | Ctype |  Access privileges  
--------------+---------+----------+---------+-------+---------------------
 postgres     |  fuiba  | UTF8     | C       | C     | 
 template0    |  fuiba  | UTF8     | C       | C     | =c/fuiba         +
              |         |          |         |       | fuiba=CTc/fuiba
 template1    |  fuiba  | UTF8     | C       | C     | =c/fuiba         +
              |         |          |         |       | fuiba=CTc/fuiba
(3 rows)
我做错了什么?任何帮助都将不胜感激。谢谢大家!


ps:我在Windows 7上运行pgAdmin III,在Linux CentOS上运行PostgreSQL。

我曾经为此而挣扎,它通过更改
pg_hba.conf
中条目的IP掩码来工作,但我记不清了,而且每个网络的配置都不同。关键是,您很可能在其中一个条目中出现错误,它们甚至指出错误消息是对哪个条目的提示。如果它们确实正确,我会检查(例如,查看我的密码是否作为MD5哈希传递)


我希望这能帮助您=)

pgAdmin从另一台主机连接到PostgreSQL,而不是通过SSH登录到数据库服务器。错误消息中提到的IP地址(以93.39开头)在您的
pg_hba.conf
中没有提到


将运行pgAdmin的主机的公共IP地址(以93.39开头)添加到
pg_hba.conf
或通过SSH隧道连接。请注意重新加载PostgreSQL的配置,或者在修改
pg_hba.conf

后重新启动PostgreSQL。我尝试添加IP
93.39.12.345
,但没有成功。我重新启动了Postgres,我得到了
psql:无法连接到服务器:连接被拒绝..
。可能我需要将IP更改为
93.39.12.345/32
93.39.12.345/16
?引用PostgreSQL的优秀文档:以这种方式指定的IP地址范围的典型示例为:单个主机为172.20.143.89/32,小型网络为172.20.143.0/24,大型网络为10.6.0.0/16。0.0.0.0/0表示所有IPv4地址,并且::/0表示所有IPv6地址.在“非常感谢您”@AugustusHow do u slove this???@Fuiba”的结尾有一个详尽的例子
[fuiba@test]$ psql -h localhost -p 26888 -d postgres
psql (9.1.11)
Type "help" for help.

postgres=# \l
                             List of databases
     Name     |  Owner  | Encoding | Collate | Ctype |  Access privileges  
--------------+---------+----------+---------+-------+---------------------
 postgres     |  fuiba  | UTF8     | C       | C     | 
 template0    |  fuiba  | UTF8     | C       | C     | =c/fuiba         +
              |         |          |         |       | fuiba=CTc/fuiba
 template1    |  fuiba  | UTF8     | C       | C     | =c/fuiba         +
              |         |          |         |       | fuiba=CTc/fuiba
(3 rows)