I recently did a bbPress database migration successfully using Discourse’s inbuilt migration script. Now I’m going to share it as a step-by-step tutorial.
Note: This tutorial is for the bbPress plugin, not the legacy standalone version of bbPress.
What data can be imported?
- Users (including anonymous users)
- Categories
- Topics
- Posts
- Private Messages (via BuddyPress)
- Attachments
- Permalinks
Before starting the migration set a development environment on your machine (or inside a virtual machine) and run the import there instead of inside the docker container. When I tried it inside docker container I got peer authentication failed issue. So I strongly recommending you that you use a development machine. See the macOS or Ubuntu / Debian installation guide for development.
Discourse requires Ruby 3.4+. You can check your Ruby version with:
ruby -v
Now we need to install the libmysqlclient-dev dependency in order to be able to use the mysql2 gem.
sudo apt-get install libmysqlclient-dev
After the successful installation go to your Discourse development installation path (typically ~/discourse).
cd ~/discourse
Configuring the database connection
The bbPress import script reads all database connection settings from environment variables. You do not need to edit the script file. The following environment variables are supported:
| Variable | Default | Description |
|---|---|---|
BBPRESS_HOST |
localhost |
MySQL database host |
BBPRESS_USER |
root |
MySQL username |
BBPRESS_PW |
(empty) | MySQL password |
BBPRESS_DB |
bbpress |
MySQL database name |
BBPRESS_PREFIX |
wp_ |
WordPress table prefix |
BBPRESS_ATTACHMENTS_DIR |
/path/to/attachments |
Path to bbPress attachments directory |
If you are migrating your database from localhost you typically only need to set the database name:
IMPORT=1 bundle && IMPORT=1 BBPRESS_DB="my_bbpress" bundle exec ruby script/import_scripts/bbpress.rb
If you are migrating your database from an external server you’ll also need to set the host, username, and password:
IMPORT=1 bundle && IMPORT=1 BBPRESS_HOST="REMOTE_HOST_NAME" BBPRESS_USER="DB_USERNAME" BBPRESS_PW="MY_SECURE_PASSWORD" BBPRESS_DB="DB_NAME" bundle exec ruby script/import_scripts/bbpress.rb
Congratulations! Your database successfully migrated from bbPress to Discourse
![]()
Now take a backup from admin page /admin/backups and import it in your live Discourse website.
After you moved your bbPress forum to Discourse if you are still going to use your WordPress website as primary site and you’d like to connect it with Discourse then install Discourse’s official WordPress plugin.
Last edited by @JammyDodger 2024-05-27T14:54:29Z
Check document
Perform check on document:


