• CentOS7下安装PostgreSQL12


    使用yum命令添加PostgreSQL软件源

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

    使用yum命令安装PostgreSQL

    yum install postgresql12
    yum install postgresql12-server
    yum install postgresql12-contrib

    初始化数据库

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

    配置开机启动与启动

    systemctl enable postgresql-12
    systemctl start postgresql-12

    切换到postgres用户。然后执行修改用户密码SQL语句。其中“postgres”为要修改密码的用户,“123456”为用户的密码

    su - postgres
    psql -c "alter user postgres with password '123456'"

    配置远程访问

    vi /var/lib/pgsql/12/data/postgresql.conf
    将“#listen_addresses = ‘localhost’”改为“listen_addresses = ‘*’

    打开并编辑文件“/var/lib/pgsql/12/data/pg_hba.conf”。在文件的末尾添加“host all all 0.0.0.0/0 md5”

    重启服务

    systemctl  restart postgresql-12
  • 相关阅读:
    [HDU6793] Tokitsukaze and Colorful Tree
    [NOI2020]命运
    [NOI2020]美食家
    模拟9
    晚测2
    模拟8
    联考4
    模拟7
    模拟6
    关于数论
  • 原文地址:https://www.cnblogs.com/xiaofengfree/p/13343399.html
Copyright © 2020-2023  润新知