請問我PostgresSQL 8.4 架在VM ubuntu 11.04 ,IP 為192.168.81.134,沒開防火牆,
在遠端打開 phppgadmin 管理沒有問題,但想用pgAdmin III連線一直都連不上,不知道有沒有高手可以幫我解決,
/etc/postgresql/8.4/main/pg_hba.conf 設定檔內容如下:
local all postgres ident
local all all ident
host all all 127.0.0.1/32 md5
host all all 192.168.11.1/24 md5
host all all 192.168.11.1/24 trust
host all all 192.168.84.1/24 trust
host all all ::1/128 md5
/etc/postgresql/8.4/main/postgresql.conf 有加上
listen_addresses = '*'
port = 5432
no pg_hba.conf entry for host "192.168.81.1"
跑pgadmin III的機器的IP是192.168.81.1, 並未被授權連線postgresql server, 必須在pg_hba.conf中授權, 加入:
host all all 192.168.81.1/32 trust
/etc/postgresql/8.4/main/pg_hba.conf 設定檔內容如下:
local all postgres ident
local all all ident
host all all 127.0.0.1/32 md5
host all all 192.168.11.1/24 md5
host all all 192.168.11.1/24 trust
host all all 192.168.84.1/24 trust
host all all 192.168.81.1/32 trust
host all all ::1/128 md5
至於192.168.11.1/24, 192.168.11.1/24, 192.168.84.1/24應該都改為
192.168.11.1/32, 192.168.11.1/32, 192.168.84.1/32
至於官方建議的:
[quote]You'll probably want to add something like
host all all 192.168.0.0/24 md5[quote]
則不必這樣做, 每次只需開放單一IP就好了.
你的設定 host all all 192.168.84.1/24 trust
錯誤訊息的提示 something like host all all 192.168.0.0/24 md5
建議改成 host all all 192.168.84.0/24 trust
當然還有其他網段也改,試試看.