Redhat、centos安装配置postgresql
生活随笔
收集整理的這篇文章主要介紹了
Redhat、centos安装配置postgresql
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
一.安裝postgresql
本文僅以 redhat,postgresql9.4為例,使用yum方式進行介紹。
官網:http://www.postgresql.org/download/linux/redhat/
1.下載postgresql的yum源
yum install http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-redhat94-9.4-1.noarch.rpm
?
2.安裝
yum install postgresql94-server postgresql94-contrib
?
二,配置postgresql
1.初始化數據庫
service postgresql-9.4 initdb ?
2.設置默認啟動
chkconfig postgresql-9.4 on ?
三,啟動,重啟,關閉服務,修改密碼
命令:
service postgresql-9.4 start / restart / stop ?
修改密碼:
postgres=#alter user postgres with password 'new password'; postgres=#\q
?
四.修改postgresql配置文件
1.pg_hba.conf 文件
默認位置:/var/lib/pgsql/9.4/data/pg_hba.conf , 第80行修改如下:# IPv4 local connections:host all all 本機IP/0 md5(使用md5加密連接數據庫)
host all all 0.0.0.0/0 md5(使用md5加密連接數據庫) -- 監聽全部地址,其他機器也可以連接本機。
?
2.postgresql.conf 文件
默認位置:/var/lib/pgsql/9.4/data/postgresql.conf ,第59行修改如下listen_addresses = '*' (監聽的IP )port = 5432(監聽端口)
?
3.修改完畢,重起服務
轉載于:https://www.cnblogs.com/swbzmx/p/5604300.html
總結
以上是生活随笔為你收集整理的Redhat、centos安装配置postgresql的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 多态---父指针指向子类对象(父类引用指
- 下一篇: 手抓饼多少钱一箱,一箱多人少个?