purazumakoiの[はてなブログ]

技術メモから最近はライフログも増えてきてます。

navicatでPostgreSQL8に接続する

同じような症状のブログがあったので非常に助かりました。


via
サバカン日記+::pgadminIII


内容はほぼ引用です。


navicatで社内サーバのPostgreSQLに接続しようとおもったら

could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "192.168.***.***" and accepting
TCP/IP connections on port 5432?

って出たので(webのpgadminからは接続できている)


/var/lib/pgsql/data/postgresql.conf
postgresql.conf」で

listen_addresses = 'localhost'
↓
listen_addresses = '*'

に変更
/etc/rc.d/init.d/postgresql restart
で再起動


navicatで今度は以下のエラーが出る

FATAL: no pg_hba.conf entry for host "192.168.***.***",
user "hogehoge", database "template1"


postgresql.conf」と同じ階層にある「pg_hba.conf」をいじる

# IPv4 local connections:
host    all         all         127.0.0.1/32          trust
host    all         all         192.168.1.0/24        trust ← この部分を増やした

これにより、「192.168.1.*」からのipは無条件で許可される。
ちなみに、IP固定(192.168.1.100だけ)にしたい場合は
「192.168.1.100/32」という感じで32のマスクをかける


via
Openmya Hiki - ネットワークアドレスとサブネットマスク