yum安装
yum install postgresql
yum install postgresql-server
新增用户,修改密码,创建数据库
su - postgres
psql
#pg数据库用户
create user postgres2 with password ‘123456’;
create database postgres2 owner postgres2;
grant all privileges on database postgres2 to postgres2;
ALTER USER postgres WITH PASSWORD ‘123456’;
alter role postgres2 login
vi /var/lib/pgsql/data/pg_hba.conf
#增加一行
host all all 0.0.0.0/0 md5
重启
pg_ctl stop
pg_ctl start
登录
psql -h 127.0.0.1 -U postgres2
参考
[1]https://www.w3cschool.cn/postgresql13_1/postgresql13_1-lxny3jfa.html
[2]https://www.jianshu.com/p/140cb8c6a2c6