PgAdmin on Windows 10 with Postgres when installed via Bash on Ubuntu on Windows

posting in case someone had my issue

In my case I was getting Connection refused, I was able to resolve by changing listen_addresses property to '*' inside postgresql.conf file

To locate conf file on ubuntu

sudo -u postgres psql -c 'SHOW config_file'

once you find the file, you need to change listen_addresses like this

listen_addresses = '*'

Then restart postgres using

sudo service postgresql restart

you might need to change the permission of the file before you can edit it, don't forget to revert this change once done.


Here's what I did to connect Postgres DB installed in WSL Ubuntu from Windows pgAdmin.

  1. Launch Ubuntu in Windows.
  2. Start postgres in Ubuntu terminal: sudo service postgresql start
  3. Download the latest pgAdmin and install in Windows.
  4. Launch pgAdmin, a new tab in browser opens; click on Add New Server link.
  5. In the popup Create - Server window in the browser:
    1. General tab: I set Name to localhost
    2. Connection tab: I set Host name/address to localhost, set Password to postgres, which is the default, click on Save password?
    3. I save the setting, leaving the rest of the fields as is
  6. That's it, I can see the DB created in Postgres immediately.

Browser screenshot on adding a server


The answer provided by @kiatng helped me too. However, I was getting a socket not connected error when I was trying to access the data in my tables. Through another Google search, I found I needed to change localhost to 127.0.0.1 and then I was able to access the data. Just putting this here in case it helps someone else. I would have replied to kiatng's answer but I don't quite have enough 'reputation' yet to do so!