postgresql-on-ubuntu

Ubuntu 16.04.2 組み込みposgresの設定

postgresユーザは、パスワードがない

1
postgres=# ALTER USER postgres PASSWORD '****'

psql: FATAL: Peer authentication failed for user “postgres”の対応

1
2
3
4
$ sudo vi /etc/postgresql/9.1/main/pg_hba.conf
local all postgres peer
local all postgres md5

port open

1
2
3
4
5
# vi /etc/postgresql/8.2/main/postgresql.conf
#listen_addresses = 'localhost'
listen_addresses = '*'
$ sudo service postgresql restart

参考

How To Install and Use PostgreSQL on Ubuntu 16.04

Postgresql: password authentication failed for user “postgres”

Getting error: Peer authentication failed for user “postgres”, when trying to get pgsql working with rails