我正在尝试从 pgAdmin III 连接到远程数据库。我已经创建了一个 "New Server Registration"。当我连接到数据库时,我得到了"access to database denied"的错误信息。
我已正确设置了所有内容。这是我的 PostgreSQL 设置:
- pg_hba.conf >
PostgreSQL 客户端身份验证配置文件
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all postgres trust
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
host all all 192.168.0.0/16 md5
- postgresql.conf > 我允许所有进入的连接
listen_addresses = '*'
使用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,PostgreSQL 在 Linux CentOS 上。
93.39.12.345
但是无法工作。我重新启动了Postgres,但是出现了psql: could not connect to server: Connection refused ..
的错误。可能我需要将我的IP更改为93.39.12.345/32
或93.39.12.345/16
? - Mustapha Aoussar