[英]How to connect to a PSQL database on the same network but running on a different computer
我嘗試了很多東西,到目前為止我的理解是讓 psql 服務器(計算機 1)偵聽將要連接到它的另一台計算機(計算機 2)。 我打開了我的 pg_hba 配置文件:
# "local" is for Unix domain socket connections only
local all all scram-sha-256
# IPv4 local connections:
host all all 127.0.0.5/32 scram-sha-256
# IPv6 local connections:
host all all ::1/128 scram-sha-256
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all scram-sha-256
host replication all 127.0.0.1/32 scram-sha-256
host replication all ::1/128 scram-sha-256
到目前為止,它似乎正在偵聽本地網絡上運行的所有服務器。
當我嘗試使用 CMD 從計算機 2 連接時
psql -h 127.0.0.5 -U postgres;
系統提示我輸入密碼,但我連接的數據庫是在計算機 2 上運行的數據庫,而不是在計算機 1 上運行的數據庫
我可以在這里做什么? 感謝您閱讀到目前為止。
psql
是 Postgres 客戶端的名稱。 當提到服務器時,請使用 Postgres 或 Postgresql。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.