日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > centos >内容正文

centos

Centos 7 安装 PostgreSQL

發布時間:2025/3/15 centos 82 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Centos 7 安装 PostgreSQL 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

本文只講PostgreSQL在CentOS 7.x 下的安裝,其他系統請查看:https://www.postgresql.org/download

PostgreSQL 所用版本為:PostgreSQL 10

1.安裝存儲庫

yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-1.noarch.rpm

2.安裝客戶端

yum install postgresql10

3.安裝服務端

yum install postgresql10-server

4.驗證是否安裝成功

rpm -aq| grep postgres

輸出如下:

4.初始化數據庫

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

5.啟用開機自啟動

systemctl enable postgresql-10 systemctl start postgresql-10

6.配置防火墻

firewall-cmd --permanent --add-port=5432/tcp firewall-cmd --permanent --add-port=80/tcp firewall-cmd --reload

7.修改用戶密碼

su - postgres? 切換用戶,執行后提示符會變為 '-bash-4.2$'psql -U postgres 登錄數據庫,執行后提示符變為 'postgres=#'ALTER USER postgres WITH PASSWORD 'postgres'? 設置postgres用戶密碼為postgres\q? 退出數據庫

8.開啟遠程訪問

vim /var/lib/pgsql/10/data/postgresql.conf修改#listen_addresses = 'localhost' 為 listen_addresses='*'當然,此處‘*’也可以改為任何你想開放的服務器IP

9.信任遠程連接

vi m/var/lib/pgsql/10/data/pg_hba.conf修改如下內容,信任指定服務器連接# IPv4 local connections:host? ? all? ? ? ? ? ? all? ? ? 127.0.0.1/32? ? ? trusthost? ? all? ? ? ? ? ? all? ? ? 192.168.157.1/32(需要連接的服務器IP)? trust

10.重啟服務

systemctl restart postgresql-10

11.使用DBMS軟件連接

這里使用的是Navicat

連接成功:

轉載于:https://www.cnblogs.com/stulzq/p/7766409.html

總結

以上是生活随笔為你收集整理的Centos 7 安装 PostgreSQL的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。