zoukankan      html  css  js  c++  java
  • CentOS7 yum安装、配置PostgreSQL 9.6

    PostgreSQL 9.6安装

    1、添加RPM

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

    2、安装PostgreSQL 9.6

    sudo yum install -y postgresql96-server
    

    3、初始化数据库

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

    4、设置开机自启动

    sudo systemctl enable postgresql-9.6
    

    5、启动服务

    sudo systemctl start postgresql-9.6
    

    6、查看版本

    psql --version
    

    PostgreSQL 9.6配置

    1、修改用户密码

    su - postgres
    psql -U postgres
    ALTER USER postgres WITH PASSWORD '123456' 
    q

    2、开启远程访问

    vi /var/lib/pgsql/9.6/data/postgresql.conf
    修改#listen_addresses = 'localhost'  为  listen_addresses='*'
    

    3、信任远程连接

    vi /var/lib/pgsql/9.6/data/pg_hba.conf
    
    修改如下内容,信任指定服务器连接
    # IPv4 local connections:
    host    all            all      127.0.0.1/32      trust
    host    all            all      192.168.137.1/32(需要连接的服务器IP)  trust

    #“host” 代表主机类型,第一个“all”代表db ,第二个“all”代表user ,“192.168.137.1/32” 代表client ip,“trust”代表认证方式;
    #认证方式除“trust”外,还有“peer”, “ident”等,具体可参考pg-hba文件: https://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html

    4、重启服务

    systemctl restart postgresql-9.6.service
    
  • 相关阅读:
    练习二(米奇老鼠)
    Photoshop笔记一
    HTML笔记1
    用IDEA写出第一个java web
    TCP协议怎么关闭?
    Sql Server2008R2与IDEA的连接
    通过HttpServer向Prometheus暴露端点
    了解Prometheus到底是什么?
    SPI扩展机制在框架中的使用
    motan系列1——与spring的集成原理
  • 原文地址:https://www.cnblogs.com/shhnwangjian/p/14680679.html
Copyright © 2011-2022 走看看