I have installed Postgresql 14 on WSL2 & Datagrip in windows. After connecting postgresql databases from WSL2 to Datagrip it works fine, but after a few seconds or minutes it says refure to connect:

enter image description here

I think somehow the IP or something is blocking by WSL2 or maybe windows 11 has problem with wsl2 again


WSL     : 2
Windows : 11
Disto   : Ubuntu-22.04
  • I'm 90% confident that those are two separate problems. Would you consider posting "Problem 2" as a separate question? The new question would be about "Why localhost is not working from Windows 11 to WSL2". I can provide likely provide answers to both, but they are definitely two different answers to the two different questions. Thanks! Aug 27, 2022 at 15:05
  • @NotTheDr01ds Thanks, Can you help me now? (I did problem 2 cause I was 99% confident it was not postgresql but the whole network connection problem between WSL2 & Windows) Aug 28, 2022 at 0:54
  • Thanks for the rewrite - You are probably correct and they may be the same problem. The way the title was written, I thought the first problem was about connecting from WSL2 to Windows, and the second was about connecting from Windows to WSL2. But it sounds like both are about connecting from Windows to WSL2 - Is this right? Don't worry about editing the question again (for now) - But do try running wsl --shutdown (from PowerShell) and try again. You may be running into a common bug, so let's rule that out as a possibility first. Thanks! Aug 28, 2022 at 1:47
  • Thanks for your valuable time. I tried wsl --shutdown restarting windows again, installing a new distro to check if work (not a smart work but just to make sure it works or not) At this point it didn't fix anything. Aug 28, 2022 at 1:55
  • Ok, let's try a super-simple test. It should fail, since your React test failed, but simply run python3 -m http.server 3001. Can you access localhost:3001 in Chrome in Windows? Again, I'm expecting it to fail, but that should then tell us what type of problem we're looking at. Not sure if I can solve it, but at least I can provide some possibilities at that point. Thanks! Aug 28, 2022 at 2:03

1 Answer 1


This is not an answer for the original problem, but there was a bounty added on this question on January 26th, 2023 that is likely a different root issue, but with the same symptoms as the original question. This answer, I believe, will address the new issue (but ironically, 1 hour too late for the bounty).

This sounds like a bug in the 1.1.0 pre-release of WSL that was reported in issue (#9508). The timing of the appearance of this issue for the bounty-poster would roughly coincide with this release.

The issue is reported to be mostly fixed in a new pre-release yesterday, (1.1.2).

  • WSL2 is good not the best option for many reasons even though they are using the kernel! I had a lot issues with network & slow file system 😣. According to their recommendations creating file inside the Linux file system has massive performance improvement. But I don't know how my network & other problems fixed. (Maybe for the update or switching to other distro) Feb 5, 2023 at 3:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .