Skip to content

Instantly share code, notes, and snippets.

@TheLexoPlexx
Last active February 3, 2023 15:37
Show Gist options
  • Save TheLexoPlexx/40e34fdfc56c28d19e3954f0ff7e9afc to your computer and use it in GitHub Desktop.
Save TheLexoPlexx/40e34fdfc56c28d19e3954f0ff7e9afc to your computer and use it in GitHub Desktop.
pgAdmin and postgresql on WSL2

Show config file location with sudo -u postgres psql -c 'SHOW config_file'

Edit the file, default: sudo nano /etc/postgresql/14/main/postgresql.conf

listen_addresses = '*'
port = <remember-port>

sudo ufw allow <port>

Edit sudo nano /etc/postgresql/14/main/pg_hba.conf

# IPv4 local connections:
host    all             all             127.0.0.1/32            trust

sudo service postgresql restart and sudo ufw reload

Connect using pgAdmin as usual with 127.0.0.1 and the port.

This is very insecure, use only for local dev-environments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment