DA48A5AAD1CB8C682C84AFD38AD5D864.jpg

安装

yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum install postgresql11 -y
yum install postgresql11-server -y

初始化

/usr/pgsql-11/bin/postgresql-11-setup initdb

配置,增加远程访问

默认情况下会安装在 /usr/pgsql-11/
vim /var/lib/pgsql/11/data/postgresql.comf
修改listen_addresses = '*'
vim /var/lib/pgsql/11/data/pg_hba.comf
增加host all all 0.0.0.0/0 password

登录数据库,建库改密码

[root@db data]# su - postgres
-bash-4.2$ psql
psql (11.3)
Type "help" for help.

postgres=# create database restyaboard;
CREATE DATABASE
postgres=# alter user postgres with encrypted password '123456'

重启数据库,通过5432访问

systemctl enable postgresql-11
systemctl start postgresql-11

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code