PostgreSQL 配置遠端訪問

2021-08-18 21:55:37 字數 665 閱讀 8652

配置遠 程連線postgresql資料庫的步驟很簡單,只需要修改data目錄下的

pg_hba.conf

postgresql.conf。

pg_hba.conf:

配置對資料庫的訪問許可權,

postgresql.conf:

配置postgresql資料庫伺服器的相應的引數。

修改pg_hba.conf檔案

host  all    all    192.168.1.0/24    md5

新新增的內容,表示允許網段192.168.1.0上的所有主機使用所有合法的資料庫使用者名稱訪問資料庫,並提供加密的密碼驗證。

其中,數字24是子網掩碼,表示允許192.168.1.0--192.168.1.255的計算機訪問!

.修改postgresql.conf檔案

定位到#listen_addresses=』localhost』。postgresql安裝完成後,預設是只接受來在本機localhost的連線請 求。

將行開頭都#去掉,將行內容修改為listen_addresses=』*'來允許資料庫伺服器監聽來自任何主機的連線請求

Postgresql12 安裝及設定遠端訪問

1.安裝 centos 7 拉取rp包,並install yum install install pg服務 yum install postgresql12 server 初始化db usr pgsql 12 bin postgresql 12 setup initdb 啟動服務 systemctl...

配置PostgreSQL遠端訪問

編輯資料資料夾下的pg hba.conf檔案,找到 type database user address method ipv4 local connections host all all 127.0.0.1 32 md5 host testdb postgres 192.1.1.2 32md5 ...

PostgreSql 配置遠端連線

修改 var lib pgsql 10 data pg hba.conf 配置對資料庫的訪問許可權 local is for unix domain socket connections only local all all password ipv4 local connections host ...