加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

postgresql9.6 安装

发布时间:2020-12-13 16:45:07 所属栏目:百科 来源:网络整理
导读:# centos 6.8 安装# 见官网 :https://www.postgresql.org/download/linux/redhat/# 选择对应信息后。yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg-centos96-9.6-3.noarch.rpmyum install postgresql96yum ins
# centos 6.8 安装
# 见官网 :https://www.postgresql.org/download/linux/redhat/
# 选择对应信息后。
yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg-centos96-9.6-3.noarch.rpm
yum install postgresql96
yum install postgresql96-server

# 初始化
service postgresql-9.6 initdb
chkconfig postgresql-9.6 on
service postgresql-9.6 start
# 查看 数据目录
cat /etc/rc.d/init.d/postgresql-9.6 | grep -n PGDATA -n

# 远程可连接
vi /var/lib/pgsql/9.6/data/postgresql.conf 
# 59行 
listen_addresses = '*' 
# 
vi /var/lib/pgsql/9.6/data/pg_hba.conf
# 按照要求配置,笔者修改的是注释82行,增加了一行:83行
    77 # TYPE  DATABASE        USER            ADDRESS                 METHOD
     78 
     79 # "local" is for Unix domain socket connections only
     80 local   all             all                                     peer
     81 # IPv4 local connections:
     82 #host    all             all             127.0.0.1/32            ident
     83 host    all             all             192.168.1.0/24            md5
     84 # IPv6 local connections:
     85 host    all             all             ::1/128                 ident
     86 # Allow replication connections from localhost,by a user with the
su postgres  //切换用户
psql -U postgres // 进入交互式

# 修改密码
alter user postgres with password '1234';

重启后,使用pgAdmin 即可远程连接。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读