Magento Basics – How To Backup Your Store
Keeping a recent & up-to-date backup of your store is extremely important especially when you are constantly updating your catalog.
There are many risks & threats involved whilst running a website. These could involve server issues or a security breach, both of which can cause loss of data and potentially your store.
How To Backup Your Magento Store
There are 2 methods to backing up your Magento store.
Method 1
Magento has a in-built backup feature which allows you to back up your database and files. Perfectly packaged and available for download in a compressed format from your file server. Using the integrated interface you can generate backups of your database, file server or media folders as required.
System -> Tools -> Backups
I would recommend using this backup method but some hosting servers/apache configurations can cause errors which are hard to diagnose & fix.
Method 2
This method is slightly more advanced than method 1 and requires access to your cPanel & SSH/FTP. To have a complete backup of your store you need to download both the server files & the MySQL database.
Download Your Server Files
Downloading the server files can be done in a variety of ways. The quickest & most commonly used method is downloading via SSH running the following commands.
scp -r user@your.server.example.com:/path/to/foo /home/user/Desktop/
From man scp
-r Recursively copy entire directories
If you are unable to access SSH you can use a FTP GUI (Graphical user interface) client such as FileZilla which will allow you to download the files but this will take much longer especially when downloading a full Magento install which often exceed 20,000 files.
Once your entire public_html folder has been downloaded you can compress it how you wish.
Downloading Your MySQL Database
To download your MySql Database you must have access to your cPanel or PHPmyadmin.
Once you have selected your Magento database in PHPmyadmin you need to navigate to “Export” to create a database dump. Choosing custom we will configure the export so the database will import correct.
1. Under “Tables” you will see all the tables in the database. All of these tables will be required too produce a working backup. Use your shift key select all of the tables.
2. Choose the name of your export, the character set (this is usually correct by default) & your desired compression. I recommend downloading zipped or gzipped as Magento databases can be quite large.
3. Ensure that “Disable foreign key checks” is enabled. This will add SQL code into your database dumb which disables the InnoDB check with importing the database.
4. Under Format-specific options, ensure structure and data is selected.
5. In Object creation options, check Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT statement.
All other settings can be left as default. Click “Go” at the bottom of the page and your download will start.
Conor Tomkins
Senior PHP Developer
Working with PHP applications since the age of 17. I have a wide range of knowledge on most PHP open source platforms. I must admit, my favorites are Magento & Wordpress!