LoginSignup
2
3

More than 5 years have passed since last update.

homebrewでpostgresをinstallしてpasswordを設定する。

Last updated at Posted at 2015-05-02

まずは素直にインストール。

brew search postgres
brew install postgresql

終わったら画面の指示通りに。

ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

ここでパスワードを設定。

psql postgres
postgres=# \password
postgres=# \q

次にエディターで以下のファイルを編集する。

sudo vim /usr/local/var/postgres/pg_hba.conf

trust になっているところを全部 md5 に書き換え。
保存したら、postgresを一旦停止して、

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

また起動。

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
2
3
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
2
3