postgresql.conf
1 | $ vi /usr/local/pgsql/data/postgresql .conf |
リモートアクセス可能にする。
#listen_addresses = 'localhost'
↓
listen_addresses = '*'
明示的にポートを指定する。
#port = 5432
↓
port = 5432
ログを有効にする。
#logging_collector = off
↓
logging_collector = on
ログのファイル名を変更する。
#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
↓
log_filename = 'postgresql-%d.log'
#log_line_prefix = ''
↓
log_line_prefix = '%t [%p] '
pg_hba.conf
1 | $ vi /usr/local/pgsql/data/pg_hba .conf |
host all all 127.0.0.1/32 trust
↓
host all all 192.168.1.0/24 trust
設定の反映
1 | $ pg_ctl restart -w |
DBのユーザ作成
1 | $ createuser -s -d -r -P pgsa |
作成したユーザを確認する。
1 2 | $ psql -U postgres \ du |
DBの設定は以上です。次回はOS側の設定になります。