How to access a PostgreSQL database in a VMware Workstation guest from a Windows host?

Step 1

Set a password for the PostgreSQL postgres user:

sudo -u postgres psql
ALTER USER postgres PASSWORD '<a password>';

Step 2

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 3

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

listen_addresses = '*'

Step 4

Restart the postgresql service

sudo service postgresql restart

An additional information:

pegaxchange.com/2016/01/08/access-pega-7-postgresql-db

Step 5

Assign a static IP address to the VMware Workstation guest.

Step 6

My settings in pgAdmin 4:

The result (with a Discourse database)

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