Does the Discourse install set a default postgres password?

AI-generated summary

Users are discussing how to access the PostgreSQL database in a Discourse installation. 007 initially tried to access the database using psql root -h localhost but was prompted for a password. Falco suggested using su postgres and then psql, which worked. 007 also discovered that the Data Explorer plugin can be used to build queries without direct database access.

Isambard asked if there is a default password and if it is safe to change the psql user password. They also inquired about updating the corresponding password in the configuration and using the same password for python scripts.

Hi, I’m trying to get into the Discourse PostgreSQL database to learn how it’s laid out so I can do some tweaks to the import script to meet my specific needs.

Only problem is that I can’t get into psql in the docker.

When I run: psql root -h localhost I am asked for a password.

I’ve tried just hitting ENTER (psql documentation states there is no default password) but I’m told it’s incorrect.

What’s the best practice for accessing the raw database? Or is there a wiki here that shows the database structure? That’s really what I need. I have the Data Explorer plugin running, so I could explore from there, but that would be easier to do if I knew how the database is laid out.

Thanks in advance for any help!

Try

su postgres
psql

Thanks! That worked. I also dug into Data Explorer a little more and realized I could build my queries from that and didn’t even need direct db access. Helpful to know though.

I had the same question. Is there a password, if so, where is this in the configuration?

Is it safe to change the psql user password (e.g. password rotation) and where should the corresponding password be updated in the config?

If running python scripts against a database, it would be helpful to use the same password, otherwise the yml files need to be modified to create a separate database user and password and grant permissions.