Sample Header Ad - 728x90

Connect to WSL2 Postgres database from local network

0 votes
1 answer
2806 views
I run Postgres 12 service in Windows Subsystem for Linux 2 (WSL2). In my /etc/postgresql/12/main/postgresql.conf, I have:
listen_addresses = '*'
while my /etc/postgresql/12/main/pg_hba.conf has this content:
local   all    postgres                 peer

local   all    all                      peer
host    all    all         0.0.0.0/0    md5
host    all    all         ::0/0        md5

host    all    all         0.0.0.0/0    md5
host    all    all         ::0/0        md5
host    all    all         all          md5
If I try to connect to this server from any other device then the local machine, it times out. Does anyone have any idea why should this be?
Asked by vlad (103 rep)
Mar 22, 2021, 01:26 AM
Last activity: Dec 2, 2021, 11:04 AM