Linux install PostgreSQL

1, line installation

yum install postgresql-server -y

2, initialize the database

service postgresql initdb

3, set to start automatically

hkconfig postgresql on

4, start the
service postgresql start

How to modify the default password

su - postgres
psql
alter user postgres with password 'newpassword';

After the modification restart the service

service postgresql restart或者
/bin/systemctl restart postgresql.service

Test landing

psql -h 127.0.0.1 -p 5432 -U postgres

All settings can be accessed both (the default is the machine)

cd /var/lib/pgsql/data/
vim postgresql.conf
listen_addresses = '*'

Set the authentication mode, an increase in the pg_hba.conf file

host    all             all             0.0.0.0/0               password

Guess you like

Origin www.cnblogs.com/tonyzt/p/10980706.html