How can I directly edit Discourse database from a GUI?

How I solved How can I directly edit Discourse database from a GUI? since it is not answered with what I was seeking.

:warning: Do not do this on a production machine.

This uses the PostgreSQL recommended admin tool pgAdmin 4

This was done on my local machine to learn more about Discourse, e.g. install, configure, tune, develop plugins, use API, webhooks, etc.

Note: Discourse was installed on Ubuntu 18.04 on WSL 2 on Windows 10 per Beginners Guide to Install Discourse on Windows 10 for Development

Note: WSL 2 does not come with systemd. Issue 457

Using Install pgAdmin 4 on Ubuntu 20.04/18.04/16.04 as a template

Using BASH

$ echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee  /etc/apt/sources.list.d/pgdg.list
deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main
$ sudo apt update
$ sudo apt install pgadmin4 pgadmin4-apache2

pgAdmin4 user email: postgres@localhost
pgAdmin4 password: <password 1>

$ sudo /etc/init.d/apache2 restart
$ sudo ufw allow http
$ sudo ufw allow https
$ hostname -I

Record <address>

$ whoami

Record <user name>

This next step may not be needed as I did not know how to get a Postgres DB user’s password as I am not a PostgreSQL expert, or if there was another way to set up the needed DB login for pgadmin4.

$ psql postgres

Using PSQL

postgres=# ALTER ROLE <user name> '<password 2>';

Using Internet browser

http://<address>/pgadmin4

user: postgres@localhost
password: <password 1>

Once pgAdmin4 starts

Using pgAdmin4

Create a sever connection

Tab: General
   Name: Discourse Development
   Server group: Servers
Tab: Connection
   Host: localhost
   Port: 5432
   Maintenance database: postgres
   Username: <user name>
   Password: <password 2>

This is not perfect but it works and is better than nothing. Feedback and suggestions welcome.


Bonus round

PostgreSQL
Software Catalogue - Administration/development tools

2 Likes