PGSQL 在 Discourse 中是通过容器方式运行的,要访问 PGSQL 中的数据那么首先需要进入到容器后才可以。

进入容器的命令为:

 

cd /var/discourse/
 ./launcher enter app
 su discourse
 psql discourse

最后的命令是登录到运行在容器中的 pgsql。

查看 pgsql 上运行的数据库的命令为: \l

下面显示的是当前容器中运行的 pgsql 数据库。

 

discourse=> \l
                                                        List of databases
   Name    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | ICU Locale | ICU Rules |   Access privileges    
-----------+----------+----------+-----------------+-------------+-------------+------------+-----------+------------------------
 discourse | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =Tc/postgres          +
           |          |          |                 |             |             |            |           | postgres=CTc/postgres +
           |          |          |                 |             |             |            |           | discourse=CTc/postgres
 postgres  | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | 
 template0 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres           +
           |          |          |                 |             |             |            |           | postgres=CTc/postgres
 template1 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres           +
           |          |          |                 |             |             |            |           | postgres=CTc/postgres
(4 rows)

discourse=> ^C
discourse=>

 

Discourse 如何通过终端工具访问 PGSQL_数据库

 

这也是直接访问 Discourse 数据库的方法,你可以在上面的命令行工具中执行 SQL。

 

https://www.isharkfly.com/t/discourse-pgsql/16030