新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
詳解CentOS7中安裝postgreSQL11
PostgreSQL是一個功能強大的開源對象關(guān)系型數(shù)據(jù)庫系統(tǒng),他使用和擴展了SQL語言,并結(jié)合了許多安全存儲和擴展最復(fù)雜數(shù)據(jù)工作負載的功能。

莊河網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián),莊河網(wǎng)站設(shè)計制作,有大型網(wǎng)站制作公司豐富經(jīng)驗。已為莊河上1000家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)要多少錢,請找那個售后服務(wù)好的莊河做網(wǎng)站的公司定做!
1.添加PostgreSQL Yum存儲庫
sudo yum install https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-centos11-11-2.noarch.rpm
2.安裝PostgreSQL Server和客戶端軟件包
sudo yum -y install postgresql11-server postgresql11
3.初始化數(shù)據(jù)庫并啟用自動啟動
# 初始化
sudo /usr/pgsql-11/bin/postgresql-11-setup initdb
# 啟動
sudo systemctl start postgresql-11
# 設(shè)置開機自啟動
sudo systemctl enable postgresql-11
# 下面這兩個配置是關(guān)于防火墻的(我沒有用到)
sudo firewall-cmd --add-service=postgresql --permanent
sudo firewall-cmd --reload
4.啟用遠程訪問PostgreSQL(作用是可以通過公網(wǎng)連接你的數(shù)據(jù)庫,前提是你有公網(wǎng)ip)
# 我的路徑是這樣的
vi /var/lib/pgsql/11/data/postgresql.conf
# 修改
listen_addresses = '*'
# 我的路徑是這樣的
sudo vim /var/lib/pgsql/11/data/pg_hba.conf
# 修改
host all all 127.0.0.1/32 md5
# 添加
host all all 0.0.0.0/0 trust
# 重啟
sudo systemctl restart postgresql-11
5.設(shè)置PostgreSQL管理員用戶的密碼(一定要按照這種格式配置用戶名和密碼)
sudo su - postgres
psql -c "alter user postgres with password '123456'"
需要注意,如果是云服務(wù)器,需要打開對應(yīng)端口。我就吃了這個虧,折騰了很長時間。
名稱欄目:詳解CentOS7中安裝postgreSQL11
URL地址:http://m.5511xx.com/article/dhjsoec.html


咨詢
建站咨詢
