我在这里发布的第一个问题。
现在,我的笔记本电脑装有Ubuntu 12.04,在同一台机器上运行PostgreSQL 9.01 ,我有一个在VirtualBox 4.2.12下运行的虚拟化Fedora 18。
在这个虚拟化的 Fedora 上,我有PostgreSQL客户端并想连接到在 Ubuntu 上运行的 PostgreSQL 服务器。
我/etc/postgresql/9.1/main/postgresql.conf在Ubuntu服务器上编辑了文件以允许连接:       
listen_addresses = '*'
我还在同一个 Ubuntu 上编辑文件 /etc/postgresql/9.1/main/pg_hba.conf 以允许用户 postgres 连接到数据库测试:
local   postgres        test        md5
但是当我尝试从 Fedora 连接时,PgAdmin3 上会出现以下错误消息:
Access to database denied
The server doesn't grant access to the database: the server reports
FATAL: no pg_hba.conf entry for host "192.168.1.239", user "postgres", database "jpa", 
SSL on FATAL: no pg_hba.conf entry for host "192.168.1.239", user "postgres", 
database           "jpa", SSL off
To access a database on a PostgreSQL server, you first have to grant primary access 
to the server for your client (Host Based Authentication). 
PostgreSQL will check the pg_hba.conf file if a pattern that matches 
your client address / username / database is present and enabled before any 
SQL GRANT access control lists are evaluated.
The initial settings in pg_hba.conf are quite restrictive, in order to avoid 
unwanted security holes caused by unreviewed but mandatory system settings. 
You'll probably want to add something like host all all 192.168.0.0/24 md5
This example grants MD5 encrypted password access to all databases to all users 
on the private network 192.168.0.0/24.
You can use the pg_hba.conf editor that is built into pgAdmin III 
to edit the pg_hba.conf configuration file. 
After changing pg_hba.conf, you need to trigger a server configuration reload 
using pg_ctl or by stopping and restarting the server process.
我的 pg_hba.conf 是:
# Database administrative login by Unix domain socket
local   all             postgres                                peer
# TYPE  DATABASE        USER            ADDRESS                 METHOD
# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
host    all             all             10.0.2.15/16            md5
#local   postgres        postgres        md5
#local   postgres        jpa        md5
#local   postgres        test        md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                peer
#host    replication     postgres        127.0.0.1/32            md5
#host    replication     postgres        ::1/128                 md5
而10.0.2.15是虚拟化 Fedora 的 ip。
谢谢!