# 升级 v3.5.2 -\\u003e v3.6.0.beta2 后数据库访问问题

**URL:** <https://meta.discourse.org/t/database-access-issues-after-upgrade-v3-5-2-v3-6-0-beta2/387408>\
**Category:** Support\
**Created:** [2025年十一月2日 18:21 UTC](https://meta.discourse.org/t/database-access-issues-after-upgrade-v3-5-2-v3-6-0-beta2/387408 "2025-11-02T18:21:56Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Stew\_Pid](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@Stew\_Pid](https://meta.discourse.org/u/Stew_Pid)\
**Post date:** [2025年十一月2日 18:21 UTC](https://meta.discourse.org/t/database-access-issues-after-upgrade-v3-5-2-v3-6-0-beta2/387408/1 "2025-11-02T18:21:56Z")

</div>

- v3.5.2 → v3.5.2
- v3.6.0.beta2 → v3.6.0.beta2

此帖子引导我到了这里：[Upgrade failed. Database stopped. (multisite install)](https://meta.discourse.org/t/upgrade-failed-database-stopped-multisite-install/387219)

我现在遇到了数据库访问问题：

```bash

2025-11-02 17:13:51.212 UTC [1975] postgres@c_discourse LOG: 提供的用户名 (postgres) 和已验证的用户名 (discourse) 不匹配 
2025-11-02 17:13:51.212 UTC [1975] postgres@c_discourse FATAL: 用户“postgres”的对等身份验证失败 
2025-11-02 17:13:51.212 UTC [1975] postgres@c_discourse DETAIL: 连接匹配 pg_hba.conf 第 89 行：“local all postgres       
                        peer”

```

```bash
postgres=# \l
数据库列表
名称 | 所有者 | 编码 | 区域设置提供程序 | 排序规则 | Ctype | ICU 区域设置 | ICU 规则 | 访问权限
-------------±---------±---------±----------------±------------±------------±-----------±----------±-----------------------
b_discourse | postgres | UTF8 | libc | en_US.UTF-8 | en_US.UTF-8 | | | =Tc/postgres +
| | | | | | | | postgres=CTc/postgres +
| | | | | | | | discourse=CTc/postgres
c_discourse | postgres | UTF8 | libc | en_US.UTF-8 | en_US.UTF-8 | | | =Tc/postgres +
| | | | | | | | postgres=CTc/postgres +
| | | | | | | | discourse=CTc/postgres
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
(6 行)

```

multisite.yaml 在这些版本之间发生了变化。

原始：  
`secondsite: `  
` adapter: postgresql`  
` database: b_discourse`  
` pool: 25`  
` timeout: 5000`  
` db_id: 2`  
` host_names:`  
` - ``forum.domain.com`

新：  
`mlp:`  
`adapter: postgresql`  
`database: discourse_mlp`  
`username: discourse_mlp`  
`password: applejack`  
`host: dbhost`  
`pool: 5`  
`timeout: 5000`  
`host_names:`  
`- discourse.nudderdomain.com`  
`- discourse.nudderdomain.internal`

我从未为 multisite 设置过任何密码或用户，因为在设置它们时，原始模板中不需要或未列出它们。

最初，我无法升级，因为 multisite 由于 multisite.yml 中列出的两个站点的权限问题而失败。在 multisite.yml 中添加 postgres 作为用户并未能成功迁移。现在我看到也许我应该尝试 discourse？

仅仅将所有者更改为 discourse 能修复它吗？我需要为 multisite 添加用户和密码以使其与当前匹配吗？

这里最好的长期解决方案是什么？

---

_[View the full topic](https://meta.discourse.org/t/database-access-issues-after-upgrade-v3-5-2-v3-6-0-beta2/387408)._
