Linux 修改PostgreSQL外部訪問白名單


1. 查找配置文件

# find / -name pg_hba.conf
# find / -name postgresql.conf

2.修改

  2.1 修改pg_hba.conf

 查找IPv4 local connections

   修改默認的

host all all 127.0.0.1/32 trust

 為

host all all 192.168.1.1/32 trust #IP全匹配
或
host all all 192.168.1.1/24 trust #IP匹配前三段
或
host all all 0.0.0.0/0 trust #全部允許

  2.2 修改postgresql.conf

 查找 Connection Settings

 修改默認的

listen_addresses = 'localhost'

 為

listen_addresses = '*'

 

重啟postgresql服務

 

End.


免責聲明!

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



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