# 将SMF2论坛迁移到Discourse

**URL:** <https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314>\
**Category:** Sysadmins\
**Tags:** how-to\
**Created:** [2018 年6 月 20 日 14:26 UTC](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314 "2018-06-20T14:26:51Z")\
**Posts on this page:** 1\
**Showing post:** 73

<div class="post-metadata">

作者： ![JustinZ](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@JustinZ](https://meta.discourse.org/u/JustinZ)\
发布日期： [2021 年7 月 12 日 12:09 UTC](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314/73 "2021-07-12T12:09:15Z")

</div>

好的，经过数小时的反复尝试，我终于定位到了问题所在，并在此发布，供可能遇到同样困境的参考。

MySQL Docker 容器使用的是版本 8，不知为何，MySQL 模板所引用的 MariaDB 库无法正常工作。

我没有在导入 Docker 容器的配置文件中包含 MySQL 模板文件，这是第一个改动。

我构建了导入容器，并通过 `./launcher enter import` 进入其中。

然后执行：

```plaintext
echo "gem 'mysql2'" >> Gemfile
wget https://dev.mysql.com/get/mysql-apt-config_0.8.17-1_all.deb
dpkg -i mysql-apt-config_0.8.17-1_all.deb

```

该命令会弹出交互式提示，您可以选择默认选项（MySQL 8 及工具）。

接着我安装了标准的 MySQL 8 库，并继续构建：

```plaintext
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y libmysqlclient-dev
su discourse -c 'bundle config unset deployment'
su discourse -c 'bundle install --no-deployment --path vendor/bundle --jobs 4 --without test development'

```

完成上述步骤后，其余操作与之前相同，现在导入功能已正常运行。

Discourse 的开发者或许可以考虑调整导入脚本以适配此问题。至少现在论坛上已有记录，其他遇到同样问题的用户可以参考。

---

_[View the full topic](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314)._
