How to access from Windows a Discourse's PostgreSQL database installed to WSL?

It is similar to: How to access a PostgreSQL database in a VMware Workstation guest from a Windows host?

Step 1

How did I fix «could not change directory to "…": Permission denied» for PostgreSQL iin Ubuntu?

Step 2

sudo -u postgres psql

Step 3

ALTER USER postgres PASSWORD '<a password>';

E.g.:

ALTER USER postgres PASSWORD '1';

Step 4

Add the following line to the /etc/postgresql/<version>/main/pg_hba.conf file:

host    all             all             0.0.0.0/0          trust

postgresql.org/docs/9.5/static/auth-pg-hba-conf.html

Step 5

Add the following line to the /etc/postgresql/<version>/main/postgresql.conf file:

listen_addresses = '*'

Step 6

sudo service postgresql restart

Step 7

Install pgAdmin 4 to Windows.

Step 8

Step 9

Step 10

Step 11

Step 12

How do I find out the IP address of my Ubuntu in WSL?

Step 13

Result