Skip to content

Instantly share code, notes, and snippets.

@wozozo
Last active September 11, 2015 09:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wozozo/78e2258ccae18f3a0175 to your computer and use it in GitHub Desktop.
Save wozozo/78e2258ccae18f3a0175 to your computer and use it in GitHub Desktop.

Vagrant の Postgresql に外部から接続

前提

  • CentOS

以下のファイルを編集

/var/lib/pgsql/9.4/data/pg_hba.conf

host    all     all             0.0.0.0/0               password

/var/lib/pgsql/9.4/data/postgresql.conf

- #listen_addresses = 'localhost'
+ listen_addresses = '*'

restart

$ sudo service postgresql-8.4 restart
or
$ sudo /etc/init.d/postgresql-9.4 restart-all

Vagrant の外から接続してみる

pgcli -h host -U postgres -p 5432
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment