我的 Windows 机器上运行着 Postgres,我需要从 WSL2 内部连接到它。
psql172.31.210.120,网络掩码255.255.240.0(使用 确定ipfconfig)。172.31.208.1(使用 确定cat /etc/resolv.conf)curl http://172.31.208.1:8080. 如果我记录传入请求的 IP,我会得到172.31.210.120这验证两个 IP 是否正确。pg_hba.conf:host all all 172.31.210.120/20 scram-sha-256如果我尝试使用以下命令从 WSL 连接到它:
$ psql --host=172.31.208.1 --port=5432 --user=postgres
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
psql: error: could not connect to server: could not connect to server: Connection …Run Code Online (Sandbox Code Playgroud)