1.安装

yum install postgresql-server
yum install postgresql-contrib

2.启动

systemctl status postgresql


如果报错:
[root@VM_176_134_centos ~]# systemctl start postgresql
Job for postgresql.service failed because the control process exited with error code. See "systemctl status postgresql.service" and "journalctl -xe" for details.

则执行数据库初始化命令
postgresql-setup initdb

3.设置密码

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

postgres=# ALTER USER postgres WITH PASSWORD '密码';
ALTER ROLE

4.开放远程连接

cd /var/lib/pgsql/data


vi pg_hba.conf 将文件结尾处的 # host all all
127.0.0.1/32 ident 改为 # host all all 127.0.0.1/32 ident host all all 0.0.0.0/0 password vi postgresql.conf 将 #listen_addresses = 'localhost' # what IP address(es) to listen on; 改为 listen_addresses = '*' # what IP address(es) to listen on;

systemctl restart postgresql

5.测试连接

centos7安装postgresql

 

 

参考文档:

CentOS7安装配置Postgresql

PostgreSQL设置允许远程访问

相关文章:

  • 2021-06-27
  • 2022-12-23
  • 2021-07-06
  • 2021-11-12
  • 2021-12-16
  • 2021-08-14
  • 2021-09-21
猜你喜欢
  • 2021-12-22
  • 2018-03-25
  • 2018-05-31
  • 2019-06-25
  • 2021-05-28
  • 2022-02-04
  • 2022-02-01
  • 2022-03-03
相关资源
相似解决方案