# 更改站点 URL 后运行 remap 时出错

**URL:** <https://meta.discourse.org/t/error-running-remap-after-changing-site-url/406649>\
**Category:** Self-hosting\
**Tags:** sql-query, domains, postgres\
**Created:** [2026年七月2日 13:59 UTC](https://meta.discourse.org/t/error-running-remap-after-changing-site-url/406649 "2026-07-02T13:59:51Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)\
**Post date:** [2026年七月3日 02:20 UTC](https://meta.discourse.org/t/error-running-remap-after-changing-site-url/406649/13 "2026-07-03T02:20:41Z")

</div>

好吧，纯粹为了试试，我为 `script/discourse` 文件快速提交了一个 PR，以使用 `discourse db`。不太确定团队是否想添加这个功能，但它确实让在容器内进入 `sql` 控制台变得更容易。

> <https://github.com/discourse/discourse/pull/41387>
>
> Added db command to \`script/discourse\` to easily enter the PostgreSQL console.
> …
> This uses \`sudo -u postgres psql discourse\` to enter the SQL console when logged in as \`root\` inside the standard Docker container.
> 
> Example Usage:
> 
> \`\`\`bash
> cd /var/discourse
> ./launcher enter app
> \`\`\`
> \`\`\`bash
> discourse db
> \`\`\`
> \`\`\`sql
> discourse=\> SELECT count(\*) FROM users;
> discourse=\> \\q
> \`\`\`

---

_[View the full topic](https://meta.discourse.org/t/error-running-remap-after-changing-site-url/406649)._
