LoginSignup
6
5

More than 5 years have passed since last update.

リモートからmacのpostgresを接続するための設定

Last updated at Posted at 2016-05-28

pg_hba.conf 設定

接続できるIPアドレス範囲を追加
コマンド
vi /usr/local/var/postgres/pg_hba.conf

行追加
host all all 192.168.1.0/24 trust (CIDR address)

postgresql.conf 設定

他のホストより接続可能へ変更
コマンド
vi /usr/local/var/postgres/postgresql.conf

行のコメントアウトを外し、修正
listen_addresses='localhost'

DB再起動

普通は下記のコマンドです:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

が、macの自動起動ツールの影響で、うまく行けません。
launchctlコマンドを使って再起動必要があります:

launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

参照

How Do I Enable remote access to PostgreSQL database server

6
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
5