Chúc mừng Tết Trung Thu 15% off everything Shop the sale
Browse topics
Beginner All add-ons

Back up your forum before installing or updating

A backup is the database plus a few folders. How to take one before every install or upgrade, and how to check it actually works.

Updated 3 min read By the D.C Style team

On this page

Before you start

A XenForo backup is two things: a copy of the database and a copy of the forum's files. Take one before every add-on install, add-on upgrade and XenForo upgrade. Most upgrades go smoothly, but when one does not, a fresh backup turns a crisis into a five-minute restore.

What to back up

WhatWhy it matters
The databaseEvery member, post, setting and permission, plus the tables your add-ons create. This is the part you cannot rebuild.
internal_data/Attachments and other private files.
data/Avatars, attachment thumbnails and other public files.
src/config.phpYour database connection details and any config settings you added.
Everything elseXenForo and add-on code. You can download this again, but a copy of the whole folder lets you roll back an add-on upgrade in one step.

If you use Google Drive Attachments, the files it moved now live in Google Drive rather than in these folders. Back up the Drive folder too.

Back up the database

The easiest route is your hosting control panel. Most have a backup tool, or an export button in phpMyAdmin. If you have SSH access, mysqldump is quicker and works for large forums:

mysqldump --single-transaction -u your_db_user -p your_db_name | gzip > forum-db-$(date +%F).sql.gz

Your database name and user are in src/config.php, in the $config['db'] lines. --single-transaction takes a consistent copy without locking the forum while the backup runs.

Tip: To be sure nothing changes mid-backup, close the forum first. Untick "Board is active" in Setup > Options > Board active. Administrators can still browse and use the Admin CP while the board is closed.

Back up the files

From the XenForo root (the folder with admin.php and src), one command copies the whole forum:

tar -czf ../forum-files-$(date +%F).tar.gz .

Without SSH, download the forum folder by FTP or use your host's file backup. At the very least, copy data, internal_data and src/config.php.

Check the backup works

A backup you have never restored is a hope, not a backup. Two quick checks:

  • Look at the file sizes. A database dump of a few kilobytes for a busy forum means something went wrong.
  • Now and then, restore both parts to a private copy of your forum and make sure it loads. A private test copy is covered by your license. What your license covers.

Keep more than one, somewhere else

Keep the last few backups, not just the newest, because problems are sometimes noticed days later. Store at least one copy away from the forum's server. A backup on the same disk does not help if the server itself fails.

Restoring after a bad upgrade

If an add-on upgrade goes wrong, restore the database dump and the files you backed up, in that order, and the forum is back exactly as it was. Then tell us what happened before trying again, so we can fix the cause. Before restoring anything, it is worth reading Site down after installing an add-on?. Many problems can be fixed without a restore.

Still stuck? Open a support ticket and tell us what you backed up and when. We will help you work out the safest next step.

Did this guide help? Thanks! Glad it worked. Sorry about that. What went wrong? Thanks for telling us. We'll use it to improve this guide.

What went wrong?
Need a reply? Open a ticket instead.

Still stuck? Open a ticket