# Migrate a XenForo forum to Discourse

**URL:** https://meta.discourse.org/t/migrate-a-xenforo-forum-to-discourse/45232
**Category:** Sysadmins
**Tags:** how-to
**Created:** [6월 4, 2016, 1:38오전 UTC](https://meta.discourse.org/t/migrate-a-xenforo-forum-to-discourse/45232 "2016-06-04T01:38:22Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![Cyb3r](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cyb3r/32/96176_2.png) [@Cyb3r](https://meta.discourse.org/u/Cyb3r)
#### Post date: [6월 4, 2016, 1:38오전 UTC](https://meta.discourse.org/t/migrate-a-xenforo-forum-to-discourse/45232/1 "2016-06-04T01:38:22Z")

</div>

Hey guys so after trying for a week or so I decided to import the database on docker app which I hoped it will succeed without any issues. TBH I got some issues at first but it turned to be all easy to solve.

Now I would recommend doing this only once before you deploy your production site, after importing everything take a Discourse backup, wipe everything out and install new Discourse instance then restore the imported db.

Ok let’s begin:

1. **First lets backup your old database from your old server, sign in to your Discourse server then:**

2. **After installing Discourse start the app:**

3. **Now lets pull the database backup from xenforo server:**

4. **Login to docker machine, install and start mysql:**

5. **Login to mysql and create new database:**

6. **Import your xenforo database into the new one:**

7. **Include the gem in discourse Gemfile:**

8. **Run bundle install:**

9. **Edit the importer script and change the following:**

10. **You are set to go now, run the importer:**

11. **If you get the error `'Peer authentication failed for user "discourse"'`** :

12. Edit the file `/etc/postgresql/9.5/main/pg_hba.conf`

13. change all ‘peer’ to ‘trust’ and save the file

14. restart postgres server: `service postgresql restart`

Run the importer again and this time it should work without any problem, be patient this might take a while based on your database size.

Hope this helps someone. 🙂

---

_[View the full topic](https://meta.discourse.org/t/migrate-a-xenforo-forum-to-discourse/45232)._
