centos6 postgresql安装
安裝
Install the repository RPM:
yum install https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-6-x86_64/pgdg-centos11-11-2.noarch.rpm
Install the client packages:
yum install postgresql11
Optionally install the server packages:
yum install postgresql11-server
Optionally initialize the database and enable automatic start:
service postgresql-11 initdb
chkconfig postgresql-11 on
service postgresql-11 start
?
#初始化數(shù)據(jù)庫
#如果需要重新初始化,刪除目錄/var/lib/pgsql/11/data/即可
service postgresql-11 initdb
#服務開機啟動
chkconfig postgresql-11 on
#啟動服務
service postgresql-11 start
?
修改用戶密碼
su - postgres? 切換用戶,執(zhí)行后提示符會變?yōu)?'-bash-4.2$' ? ?
psql -U postgres 登錄數(shù)據(jù)庫,執(zhí)行后提示符變?yōu)?'postgres=#' ? ?
ALTER USER postgres WITH PASSWORD 'postgres'? 設置postgres用戶密碼為postgres ? ? \q? 退出數(shù)據(jù)庫
開啟遠程訪問
vi /var/lib/pgsql/11/data/postgresql.conf 修改#listen_addresses = 'localhost' 為 listen_addresses='*' 當然,此處‘*’也可以改為任何你想開放的服務器IP
信任遠程連接
vi /var/lib/pgsql/11/data/pg_hba.conf ? ? 修改如下內(nèi)容,信任指定服務器連接 ? ? # IPv4 local connections: ? ? host? ? all? ? ? ? ? ? all? ? ? 127.0.0.1/32? ? ? trust ? ? host? ? all? ? ? ? ? ? all? ? ? 192.168.157.1/32(需要連接的服務器IP)? trust
重啟服務
service postgresql-11 restart
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎總結
以上是生活随笔為你收集整理的centos6 postgresql安装的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【openeuler 21.3】Linu
- 下一篇: 软件运行 计算机硬件环境,软件运行环境该