Ultimate Guide on How to Backup Your Magento Website

Without backing up your website, you can lose a bunch of data and valuable web design work that you’ve done. The only thing worse than having your site crash is having it crash and then finding out that your last backup is a few weeks old, and you’re going to lose a bunch of work. Depending on the monetization of the site, losing data can mean losing a lot of money.

Backing Up a Magento Site

You can backup your Magento site by logging into the Magento Administration Panel. Open your dashboard, then navigate to system menu, then tools. From the tools section, you should see two options, compilation and backups. Click on backup and then click create database backup. You can then download the backup to your computer so that you can access it. 

A text box will pop up that tells you that the backup can take a long time to create. Hit ok to proceed with the process. You’ll now be asked to enter a backup name. The best way to keep track of things and to keep your backups in order is to name the backups by the date that you’ve backed them up. 

Backing up the Database in Magento

Databases are organized structures of data that websites use for various purposes. If you database gets corrupted or has any malware inserted into it, you’ll need to have a backup of the database in order to run a clean site again. The best way to do this is manually, through the control panel of Magento. Simply follow the instructions above to backup your database.

Unlike a full backup, you’ll select only the option listed as “backup database structure only” without checking the backup files. If you don’t configure the files as well you won’t have a full database, but you will have the structure which might be useful for certain migration or troubleshooting purposes.

Backing up a Magento Site When Using a Bridge Connection

If you have edited the bridge.php file and removed some of the tables then there are a few exceptions that you may want to remove. In this case, when the bridge.php file has been edited, you’ll want to uncheck the “Optimize Speed” box. If you have made some changes to the store while doing the database backup, it could lead to issues if you try to restore the backup because the database may not line up. Considering these issues with the bridge.php file, you may want to use a direct connection instead of a bridge connection for your database. Not sure what the difference is between bridge and direct connections? Then you may not have to worry about it! They reference different types of ways that your database can connect to your site.

Setting Up an Automated Magento Backup

Of course, you don’t want to be going to your Magento site to be backing it up manually every single week, or multiple times a week. Ideally, the backups are things that will run in the background that you won’t have to think about (until you really need that backup). 

There are certain programs that you can get which will allow you to automatically backup your Magento files. For example, Store Manager can allow you to automatically backup your files, which you can try for free through a download. Download Store Manager and then open the control panel. To set up automated backups, you’ll need to create a new scheduler task. Create a new configuration, and name the task name an “Automated Backup.” Select the configuration backup, and schedule the task to run once a week (or more often if you’d like it to).

Restoring a Backup for a Magento Site

Start by logging into your control panel and moving to the file manager within the control panel. Next, you’ll need to select all the files and delete them all. This can be a somewhat scary step so definitely double check that you’ve got your backups in order before deleting. You can do an additional backup of all the files in the control panel if you’re unsure, just in case something goes kinda wrong. Once you’ve deleted the files, click on the upload button within the file manager. Upload the zip that you’ve backed up and then extract the files from the backup.

Next, you’ll need to open the app or local xml file to make sure that your database is loaded to the correct database. After you’ve restored the files and are ready to restore the database, go to the phpMyAdmin tab from the control panel. Now choose the database that you’ve checked and drop all the tables into the system.

Click import and browse for the .sql file that you’ve backed up. Click go and the import will begin. 

Clear you cache and refresh your site and it should be a full restoration of the backup and backed up database that you’ve had! If anything went wrong along the way, don’t worry, you’ve still got the backed up files. Simply start the process over from the beginning and be extra careful to make sure that you haven’t made any mistakes!

General Questions About Backups

How Many Backups Should I Keep?

While you don’t need to store decades worth of information, nor is this in any way a practical data solution for most websites, you should store more than one backup at a time. The reason for this is that errors and issues can show up in your website that you may not notice right away. To use an extreme example, you may find corruptions or even outright malware in your code that you don’t notice right away. In this case, if you back up your website every single week and only have the backup from that week, you might find that even your backup has the same problem. 

This could mean ten or more hours to unwravel the problems in the site and code and get things back to fully functioning. Obviously, you might be able to avoid some of the work by sorting through the backups. There is no right answer to the number of backups that you should have on hand, so it is certainly something relative to the amount of space that have on hand. The more backups you can store the better, but also don’t worry too much about keeping backups that are years old.

Will a Backup Remove Malware?

Backups will restore previous versions of your website. While this might remove the malware that is currently on your site, there are a couple of things to remember. First of all, the backup itself might have malware that is already loaded into the system. If you backed up a version of the site that has malware in it, then restoring that backup a million times won’t remove the malware from the site! 

Second of all, restoring a backup might not prevent you from acquiring the same malware in the future version of the site. Let’s say that you restore a previous version of the website. Doing this will remove the malware that is on your current site, but without additional changes to the site, you might now simply be in the same state that you acquired the malware in the first place. If the attack was directed using some specific crawlers and direction, then you might receive the same malware through the same channels that you did the first time. If this is the situation that you are in, you may also need to find the weakness or vulnerability that allowed the malware onto the site so that you can make changes in that place.

What Do I Need to Backup In Addition to Magento

Magento isn’t the only thing that you need to backup to ensure that your website runs smoothly. Magento is an open source solution, an e-commerce platform that is one of the most popular open source e-commerce platforms in existence. While most of your relevant files will be stored within the Magento system, which is backed up as a whole, you can also keep backups on different cloud servers in order to prevent things from crashing. For example, if you were to only store backups on a local harddrive, and then that harddrive crashes, you would lose your site. You should move some backups to a cloud solution or at least to a secondary storage location. By storing data across different places you can mitigate the risk of lost data that comes from keeping it all in one place.

 

You’ll also need to have a web host to run your Magento site. Not sure where to start? We’ve got a great hosting comparison tool that you can check out!