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

postgresql安装

发布时间:2020-12-13 16:08:24 所属栏目:百科 来源:网络整理
导读:1、添加RPM yum install https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm 2、安装PostgreSQL 9.5 yum install postgresql95-server postgresql95-contrib 3、初始化数据库 /usr/pgsql-9.5/bin/post
1、添加RPM

yum install https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm

2、安装PostgreSQL 9.5
yum install postgresql95-server postgresql95-contrib

3、初始化数据库
/usr/pgsql-9.5/bin/postgresql95-setup initdb

4、设置开机自启动
systemctl enable postgresql-9.5.service

5、启动服务
systemctl start postgresql-9.5.service

6、查看版本
psql --version

7.postgresql修改密码
su - postgres
psql -U postgres
ALTER USER postgres WITH PASSWORD ‘123456‘
q

8.开启远程访问
vim /var/lib/pgsql/9.5/data/postgresql.conf
修改#listen_addresses = ‘localhost‘ 为 listen_addresses=‘*‘

9.信任远程连接
vi /var/lib/pgsql/9.5/data/pg_hba.conf
修改如下内容,信任指定服务器连接

IPv4 local connections:

host all all 127.0.0.1/32 ident
host all all 192.168.137.1/32(需要连接的服务器IP) trust

10.重启服务systemctl restart postgresql-9.5.service

(编辑:李大同)

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

    推荐文章
      热点阅读