centos 安装postgrep

时间:2022-07-28
本文章向大家介绍centos 安装postgrep,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

yum安装

yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum install -y postgresql11-server
/usr/pgsql-11/bin/postgresql-11-setup initdb
systemctl enable postgresql-11
systemctl start postgresql-11

允许远程登陆

vi /var/lib/pgsql/11/data/postgresql.conf
修改listen_addresses = '*'

修改pg.hba文件需要重启服务

vi /var/lib/pgsql/11/data/pg_hba.conf
在最后一行添加
host all all 0.0.0.0/0 md5

切换到postgres用户。然后执行修改用户密码SQL语句。其中“postgres”为要修改密码的用户,“123456”为用户的密码

su - postgres
psql -c "alter user postgres with password '123456'"