CentOS7通過yum安裝postgreSQL


選擇正確的YUM安裝源

yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

安裝postgreSQL12

yum install postgresql12-contrib postgresql12-server –y

安裝初始化

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

切換postgres用戶,並修改postgres用戶的連接密碼

su postgres 
psql
ALTER USER postgres WITH PASSWORD 'postgres';
\q

配置數據庫遠程連接信任(由於默認配置不支持密碼認證,僅可供本地服務器訪問,所以需要進行相關配置)

vi /var/lib/pgsql/12/data/pg_hba.conf

local   all  all    md5    
host all all 0.0.0.0/0 md5

開啟遠程訪問

vi /var/lib/pgsql/12/data/postgresql.conf

listen_addresses = '*'

重啟數據庫服務

systemctl restart postgresql-12


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM