当前位置:   article > 正文

Centos7安装Postgresql13_centos postgresql13 yum

centos postgresql13 yum

1、yum方式安装

创建文件 :psql_install.sh

#!/bin/bash

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

yum install -y postgresql13-server

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

systemctl enable postgresql-13

systemctl start postgresql-13
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

运行安装脚本

bash psql_install.sh
  • 1

2、进入postgresql

su - postgres
  • 1

进入sql命令行

psql
  • 1

3、创建超级用户

create user admin with password '123456' SUPERUSER;
  • 1

4、创建数据库

create database testdb;
  • 1

5、配置远程连接

修改本地配置文件:

/var/lib/pgsql/13/data/pg_hba.conf

...
host    all             all             0.0.0.0/0               password
  • 1
  • 2

/var/lib/pgsql/13/data/postgresql.conf

...
listen_addresses = '*'
  • 1
  • 2

重启postgresql

systemctl restart postgresql-13
  • 1

6、测试数据库连接

在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/589735
推荐阅读
相关标签
  

闽ICP备14008679号