Backup: Difference between revisions From Online Manual

Jump to: navigation, search
No edit summary
mNo edit summary
Line 1: Line 1:
{{TOCright}}
{{TOCright}}
Backing up is the most important thing you can ever do with SMF or any website. If something goes wrong, and you cannot fix it, what happens? Bye-bye forum. Bye-bye members. Bye-bye posts. How can you prevent this?
Backing up is the most important thing you can ever do with SMF or any website. If something goes wrong, and you are unable to fix it, what happens? Bye-bye forum. Bye-bye members. Bye-bye posts. How can you prevent this?


First -- the database.  Use a fast, reliable database backup tool (not the one that came with SMF 1.1.x or SMF 2.0).  Usually, your web host will give you one. Second -- the files.  SMF files, mods, and themes are easy to replace, but your attachments, images, and other uploaded media are priceless, so back up your files.
First -- the database.  Use a fast, reliable database backup tool (not the one that came with SMF 1.1.x or SMF 2.0).  Usually, your web host will give you one. Second -- the files.  SMF files, mods, and themes are easy to replace, but your attachments, images, and other uploaded media are priceless, so back up your files.

Revision as of 10:27, 18 April 2014

Backing up is the most important thing you can ever do with SMF or any website. If something goes wrong, and you are unable to fix it, what happens? Bye-bye forum. Bye-bye members. Bye-bye posts. How can you prevent this?

First -- the database. Use a fast, reliable database backup tool (not the one that came with SMF 1.1.x or SMF 2.0). Usually, your web host will give you one. Second -- the files. SMF files, mods, and themes are easy to replace, but your attachments, images, and other uploaded media are priceless, so back up your files.

Backing up your database

First, put your forum in maintenance mode. This will stop your members from adding to the database while you work to save it.

See what your web host gives you for database backup. You may find a link to "backup database" or else tools like phpMyAdmin or phpPgAdmin for your database. If you cannot use the website control panel, search the internet for other database backup tools.

Backing up your database with cPanel®

If your web host uses cPanel, here's the quickest way to backup your entire database.

  1. Look for the section labelled "Files" and click on "Backups".
  2. In the new page that opens, you'll see "Download a MySQL Database Backup".
  3. Under that, click on the name of your database. A dialog box will open. Choose where to save the backup.

It really is as simple as that!
So, there really is no excuse for not backing up, OK?

Backing up your database with phpMyAdmin

Start at your website's administration panel

  1. Look for the section labeled "Databases".
  2. Under that heading, you'll find "phpMyAdmin". Click on it
  3. Depending on your web host, you might have to first choose a database before logging in, or else you'll have to log in first and then choose a database.
  4. Once you are logged in (this might happen automatically) and have picked a database, you will see you have lots of options. This might seem a little scary.
  5. It is. From here, you can do anything to your database you want to do. Just stick to the script and you'll be OK.
  6. You'll see some tabs, along the top. The one you want is labeled "Export". Click it.
  7. This will take you to a page called "Exporting databases from the current server"
  8. Under Format, choose SQL. Under Export Method, choose "Custom".
  9. That opens up a whole lot of options, most of which you don't need to change.
    • Under "Select Database" make sure the database with your SMF tables in it is selected.
    • At Character set of the file" choose the character set of your database. You can find this by checking inside SMF.
    • Make sure "save output to a file" is ticked.
    • Make sure "structure and data" is checked
    • tick the box next to "Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT statement" and tick that box
  10. Then, click "Go".
  11. Save a copy of the backup some place safe. Your web host server is not a safe place -- if it is damaged, you lose both your forum AND everything you need to recreate your forum.
  12. Remember to take your forum out of maintenance mode.

After you finish the backup, VERIFY your backup. Restore it to a second, empty database. If for some reason there is something wrong with this backup, you want to know NOW so you can repeat the procedure and get it right. If you cannot get it right, talk to your host about how to solve the problem.

You don't need to go over your backup with a fine-toothed come every single time, but you should do this the first time, whenever you change how you do things, and just every once in a while. At the very least, have a look at the .sql file. It should end with something like

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

If you have a very large forum, the phpMyAdmin backup method might not work because of file size limits. If this happens to you, talk to your host about other tools you can use.

Restoring your database

Once you have a .sql file, there are a number of tools you can use to restore it.

Restoring your database with phpMyAdmin

If you have used phpMyAdmin to backup your database, you'll remember how to get started. If you have followed the instructions above, restoring the database will first wipe out everything already on the database. You'll be back at the point you were at the moment you did the backup.

  1. From the tab bar, choose the Import tab.
  2. Under Location of the text file, click Choose, and navigate to the .sql file you want to restore.
  3. If you run into any problems during the restore, this may be because of timeout limits your host has set. Do not panic. Talk to your host about what you can do . Look into utilities that can split up the import task into smaller pieces so you won't exceed time limits.

Backing up your forum files

There are two common ways of doing this. Both involve FTP. FTP to transfer files, so get comfortable with it.

Before beginning, put your forum in maintenance mode to prevent users uploading new images or documents.

One simple way to do this is to use your FTP client to download a batch of files at to your desktop. Then, you can create a zip file and store that in a safe place. This can take a very long time. Be careful to you use BINARY mode to transfer pictures, PDFs, WORD documents, etc.

A quicker way to do this is to user your site's administration panel. If you have cPanel, it will work like this:

  1. Go to cPanel, look for the section labeled "Files" and click on "Backups".
  2. In the new page that opens, you'll see "Download a Home Directory Backup".
  3. Just below that, click on the "Home Directory" button.
  4. A dialog box will pop up. Choose where to save the backup, click the button and you are done.

This might take a while. If it fails in the middle, you might have too many large files in your forum. Try backing up smaller parts of your forum at one time, or talk to your host about how to solve the problem. When the process completes, find a safe place to restore those files from backup so you can check that you got all the files you wanted.

Remember to take your forum out of maintenance mode when you are done.

Restoring your forum files

If you have simply copied all the files onto your desktop, you can use FTP to copy them all back up again.

If you have used your host's "Files" utility to create a file backup, you can use it to unpack that backup to the same location or a new one.

Or you can use the "File" or "File Manager" tool your host provides.

  1. Make sure you want to totally replace your files. You are about to go back in time to the moment you backed up these files.
  2. Go to cPanel, look for the section labeled "Files" and click on "Backups".
  3. In the new page that opens, you'll see "Restore a Home Directory Backup". Click "Choose" to navigate to your backup, then "Upload" to start the restoration.


FTP BINARY file transfer mode prevents file damage

When you use FTP, make sure you use the correct method for transferring files. "Binary" mode is the safest should be OK. If you accidentally transfer image files in "ASCII" mode, or your FTP client's "Automatic" mode does not correctly choose binary when it needs to, it will damage any image files, compressed files (.zip, .gz, .tgz, etc), non-ASCII documents (.pdf, .doc, etc), and possibly some text files that contain UTF-8 characters. You will not be able to fix these damaged files later.



Advertisement: