postgres默认安装后有哪些表_安装篇:postgresql9.6数据库安装

为了后续适配平台的 RDBMS(关系型数据库)作业类型。进行了pg数据库的安装。如下是数据库安装步骤。
  • 安装环境

CentOS7
  • 安装步骤

步骤一:安装rpm软件包

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

步骤二:安装postgresql9.6服务

yum install -y postgresql96-server

步骤三:初始化数据库

/usr/pgsql-9.6/bin/postgresql96-setup initdb

步骤四:设置开机启动、立即启动、查看状态

systemctl enable postgresql-9.6#设置开机启动systemctl start postgresql-9.6 #启动systemctl status postgresql-9.6 #查看状态

步骤五:配置远程登录(编辑 pg_hba.conf 文件)

新增:host    all             all             0.0.0.0/0            md5

vim /var/lib/pgsql/9.6/data/pg_hba.conf

817fb432490caf9aec78428438a9ed68.png

步骤六:修改监听。设置为任意IP (编辑 postgresql.conf 文件)

将localhost 改为‘*’

vim /var/lib/pgsql/9.6/data/postgresql.conf

a0f3cfe32a25019c4b81803132f1b839.png

步骤七:重启数据库

systemctl restart postgresql-9.6

步骤八:修改postgresql管理员密码

说明:postgresql在安装时会在Linux中默认创建一个postgres用户。采用postgres用户登录,通过 psql 指令本地进入数据库是不要密码的。

su postgres ##root直接进入postgres用户下psql ## 此时postgres用户可直接通过指令进入数据库ALTER USER postgres WITH PASSWORD 'postgres'; ## 修改postgres的密码为:postgres\q ##退出PostgreSQL

e903bbc853468adac0f941a91fa38218.png

步骤九:客户端登录验证。  输入IP、端口(默认:5432)、用户(管理员:postgres)、密码(根据上面修改情况输入)。

6262c7d2a9268a58d9e74500db133223.png

小结


如上是postgresql9.6版本的安装过程。

如果想优化数据库。可以对 /var/lib/pgsql/9.6/data/postgresql.conf 文件进行参数修改。这里就不做提示了,大家可以根据服务器实际情况进行调优。

postgresql官网地址:

https://www.postgresql.org/

如果大家喜欢可关注公众号,感谢!

b5ec3595d57b7ac54c37f88a2d418ccb.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值