5

I have a postgres server running on WSL2 and I am accessing it via PgAdmin (v5 and v4). Until today everything worked fine, but now I keep getting an error message when trying to connect from PgAdmin:

could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432?

These are the server settings in PgAdmin:

Host name/address: 127.0.0.1
Port: 5432

I have checked that postgres is running on port 5432 in WSL2 and listen_adresses is set to '*' in postgresql.conf

The weirdest part is that I have a NestJS app connected to the same database and it works without any errors, also donwloaded a VS Code extension that can establish connection to a postgres server and connected successfully with the credentials listed above.

So what could the problem be? Is PgAdmin bugging out?

EDIT: Restarted WSL2 and it works...

anzeha
  • 51
  • 4
  • Sounds like you may have run into [this](https://stackoverflow.com/a/63455770/11810933). Two possible causes for it - Hibernation will trigger it, as will a shutdown when Windows Fast Startup is enabled. As you've found, a `wsl --shutdown` seems to be needed to restore the localhost forwarding to the right state. – NotTheDr01ds Mar 05 '21 at 03:00

0 Answers0