postgresqlインストール - tetsuyaf1100/hello-world GitHub Wiki
install
yum install postgresql-server
psql --version
postgresql-setup initdb
systemctl enable postgresql.service
systemctl start postgresql.service
setting
- vim /var/lib/pgsql/data/pg_hba.conf
# "local" is for Unix domain socket connections only
local all all peer
↓
# "local" is for Unix domain socket connections only
local all all trust
外部からの接続を可にする
- vim /var/lib/pgsql/data/postgresql.conf
#listen_addresses = 'localhost' # what IP address(es) to listen on;
↓
listen_addresses = '*' # what IP address(es) to listen on;
- vi /var/lib/pgsql/data/pg_hba.conf
# IPv4 local connections:
host all all 127.0.0.1/32 ident
↓
# IPv4 local connections:
host all all 0.0.0.0/0 password
systemctl restart postgresql.service
password 設定
sudo -u postgres psql
postgres=# alter role postgres with password 'password';