rpm -ivh libicu-50.2-4.el7_7.x86_64.rpm
rpm -ivh postgresql13-libs-13.6-1PGDG.rhel7.x86_64.rpm
rpm -ivh postgresql13-13.6-1PGDG.rhel7.x86_64.rpm
rpm -ivh postgresql13-server-13.6-1PGDG.rhel7.x86_64.rpm
cd /usr/pgsql-13/bin
初始化
postgresql-13-setup initdb
systemctl enable postgresql-13.service
systemctl start postgresql-13.service
systemctl stop postgresql-13.service
修改访问控制 将127.0.0.1 改成0.0.0.0 scram-sha-256改trust
vim /var/lib/pgsql/13/data/pg_hba.conf
ipv4修改为以下
#IPv4 local connections:
host all all 0.0.0.0/0 trust
vim /var/lib/pgsql/13/data/postgresql.conf
listen_addresses = 'localhost' 改成listen_addresses = '*'
重启数据库
systemctl restart postgresql-13.service
#创建一个初始数据库
su postgres
createdb tempdb
createdb postgres
#创建超级用户pgdbo
createuser -s -P logs
createuser -s -P pgdbo
createuser -s -P postgres
然后就可以用该用户登录了
用指定用户登录指定数据库
psql -U pgdbo -h localhost tempdb
psql -U postgres -h localhost tempdb
psql -U postgres -h localhost logs
psql -U postgres -h localhost postgres
psql -U pgdbo -h localhost postgres
postgres
#登录后修改密码
psql 登录
\q退出数据库
sudo -u postgres psql
alter user postgres with password 'postgres'
alter user postgres with password 'ZZ2018@info!'
ZZ2018@info!
06-07
2385
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
05-28
1248
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
12-25
877
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)