How to access the discourse database?


#1

Hi all,

This is probably a stupid question but how can I access the database?
Is there something equivalent to phpadmin (or another GUI) that I can use to view and edit the database of discourse? If not, then what is the best way to access/view/edit it?


I entered the wrong admin email address during initial setup
(Jeff Atwood) #2

Install the Data Explorer Plugin and have at it.

If you want to do postgres command line stuff, you’ll need to enter the container to do that using the Docker enter command.


#3

Thank you!

I just installed the plugin, but I am getting this error message: "The data explorer is only available to admins."
This is weird because I am an admin.
Even if I use this to create a new admin account, I keep seeing this message.

My admin accounts are also visible in /admin/users/list/admins.

What do I do wrong?

Edit: omg nvm, I had to enable it first in the settings after installing it


(Frank Fang) #4

Hi, Docker enter, but what’s next?

I tried psql but got psql: FATAL: role "root" does not exist


(Sam Saffron) #5

postgres runs under the postgres user, per:

You want to sudo postgres psql discourse to hit the right user and database…


(Frank Fang) #6

I see , thank you! @sam


(Jack Tonkin) #7

In case anyone else is confused the actual command you need to run inside the container is:

sudo -u postgres psql discourse

i.e. ‘Run psql discourse as the postgres user.’