LoginSignup
8
11

More than 5 years have passed since last update.

MacのPostgreSQLでパスワードを再設定

Last updated at Posted at 2014-04-19

設定ファイルのmd5をtrustに変えてパスワードを無効にする

$ sudo vim /Library/PostgreSQL/9.3/data/pg_hba.conf
- local   all             all                                     md5
+ local   all             all                                     trust

設定ファイルを再起動

$ sudo -u postgres ./bin/pg_ctl restart -D/Library/PostgreSQL/9.3/data

パスワードなしでログインできるようになるので、パスワードを再設定

$ psql -U postgres -p 5433
postgres=# ALTER USER postgres WITH ENCRYPTED PASSWORD 'admin';
postgres=# \q

設定ファイルのパワードを有効にする

$ sudo vim /Library/PostgreSQL/9.3/data/pg_hba.conf
- local   all             all                                     trust
+ local   all             all                                     md5

設定ファイルを再起動

$ sudo -u postgres ./bin/pg_ctl restart -D/Library/PostgreSQL/9.3/data
8
11
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
8
11