PostgreSQLはデフォルトでは TCP/IP 接続を許可していない。許可するには以下のように設定する。ちなみにPostgreSQLのバージョンは7.4。
pg_hba.conf
接続を許可するホストとユーザを指定する
host test_db user_hoge 192.168.0.0 255.255.255.0 password sameuser
ユーザに対するパスワードの設定
postgres$ psql test_db
psql> alter user user_hoge with password 'NEW_PASSWORD';
pg_hba.conf で trust にした場合などはパスワードの設定は必須ではない。
postmaster.conf
postmaster 起動時に TCP/IP 接続を受け入れるように指定する。
tcpip_socket = true