Backup: Difference between revisions From Online Manual

Jump to: navigation, search
(updated phpMyAdmin description (they have reordered some of the options). generalized the "cpanel file backup" instructions because not all web hosts use this utility.)
(→‎Backing up your forum files: reverted to K@'s cPanel-specific instructions)
Line 60: Line 60:
There are two common ways of doing this.  At some point, you are probably going to need to use [[FTP_-_How_do_I_use_FTP|FTP]] to transfer files, so get comfortable with it.
There are two common ways of doing this.  At some point, you are probably going to need to use [[FTP_-_How_do_I_use_FTP|FTP]] to transfer files, so get comfortable with it.


One simple way to do this is to use your FTP client and download everything to your hard disk (ftp can transfer multiple files at one time; learn how your client does this). Then, you can create a zip file and store it in a safe place.  This can take a long time, because you are transferring files BEFORE you compress them.  And be very careful that you use BINARY mode to transfer anything that is not save to transfer in ASCII mode.  Use your FTP client's "Binary" setting.
One simple way to do this is to use your FTP client and download a bunch of files at one time to your desktop. Then, you can create a zip file and store that in a safe place.  This can take a long time, because you are transferring a long list of uncompressed files.  And be very careful that you use BINARY mode to transfer anything that is not save to transfer in ASCII mode.  Use your FTP client's "Binary" setting.


A quicker way to do this is to user your site's administration panel.  Usually, they provide a way to manage files.   
A quicker way to do this is to user your site's administration panel.  Usually, they provide a way to manage files.   
#Put your forum in maintenance mode
#Put your forum in maintenance mode
#Look for something like "Files" or "File Manager"
#Go to cPanel, look for the section labeled "Files" and click on "Backups".
#Look for a link to "Backups" or "archive". Click on or use a tick-box next to the directory you want to back up
#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.
# Follow the instructions to create a file.
#* Choose a compressed file type to save on storage space (.zip, .tar.gz, or .tgz, depending on what you can read from your desktop)
#* Choose a compressed file (.zip, .tar.gz, or .tgz, depending on what you can read from your desktop)
# Store that file in a safe place.
#* The utility might ask you immediately for a location on your PC.  Choose where you want the file to go.
#* The utility might instead create a file on the server. After it is done, use FTP to bring it to your PC.
#Store that file in a safe place.  If your desktop PC goes kapluie, what then?
# Double check your files, especially image files, to make sure they were not corrupted.
#Remember to take your forum out of maintenance mode.
#Remember to take your forum out of maintenance mode.
# Double check your files, especially image files, to make sure they were not damaged -- especially images, pdfs, and other non-ASCII documents.


This will save your whole site. So, be aware, of course, that this can take a LONG time to do, especially if you have a lot of files on your site.
This will save your whole site. So, be aware, of course, that this can take a LONG time to do. If you have a lot of big files on your site, this process might fail.  You might need to archive just a part of your site at a time -- one or two directories at a time.  If you cannot get this to work, talk to your host.
 
If you have a lot of big files on your site, this process might fail.  You might need to archive just a part of your site at a time -- one or two directories at a time.  If you cannot get this to work, talk to your host.


==Restoring your forum files==
==Restoring your forum files==

Revision as of 12:21, 10 April 2014

Backing up is the most important thing you can ever do with SMF or any website. If something goes wrong, you may be able to fix it, or someone else may be able to fix it. But if nobody can fix it, what happens? Bye-bye forum. Bye-bye members. Bye-bye posts. Now, you REALLY do not want that to happen, do you? Of course not. So, what to do?

First -- the database. While SMF 1.1.x and SMF 2.0.x had backup tools, these were not always reliable. You'll want a fast, reliable database backup tool. Usually, your web host will provide you one that works with your database. Second -- the files. While you can always re-install SMF and mods, you cannot get back attachments or any gallery mod uploads. You'll want to back up these files also.

Backing up your database

First, put your forum in maintenance mode. You don't want your members trying to add new posts to the database while you are trying to back things up.

Your web host will provide you tools for backing up the database. Poke around your account administration panel. You may find a link to "backup database" or else you'll find tools like phpMyAdmin or phpPgAdmin to work with your specific database. If you do not have access to your site's control panel, just search the internet for some other tools you can use for backups.

Backing up your database with cPanel®

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

  1. Firstly, look for the section labelled "Files" and click on (You guessed it) "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 and a requester will open, so that you can choose where that backup should be downloaded to.

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. At some point, you are probably going to need to use FTP to transfer files, so get comfortable with it.

One simple way to do this is to use your FTP client and download a bunch of files at one time to your desktop. Then, you can create a zip file and store that in a safe place. This can take a long time, because you are transferring a long list of uncompressed files. And be very careful that you use BINARY mode to transfer anything that is not save to transfer in ASCII mode. Use your FTP client's "Binary" setting.

A quicker way to do this is to user your site's administration panel. Usually, they provide a way to manage files.

  1. Put your forum in maintenance mode
  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.
    • Choose a compressed file type to save on storage space (.zip, .tar.gz, or .tgz, depending on what you can read from your desktop)
  4. Store that file in a safe place.
  5. Remember to take your forum out of maintenance mode.
  6. Double check your files, especially image files, to make sure they were not damaged -- especially images, pdfs, and other non-ASCII documents.

This will save your whole site. So, be aware, of course, that this can take a LONG time to do. If you have a lot of big files on your site, this process might fail. You might need to archive just a part of your site at a time -- one or two directories at a time. If you cannot get this to work, talk to your host.

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.

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. Click around. Look for Backups, or an option to Import or Upload files.
    • It might upload the file directly from your hard drive
    • Or you might have to use FTP to copy the compressed file to your website
  3. Look for an option to Restore or Uncompress a file
  4. Follow the instructions to get that file onto your web server and uncompressed.


General Notes

  1. 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, you will corrupt all your image files, as well as any files that contain UTF-8 characters. You will not be able to fix these files.


Advertisement: