Backing up a website's database before a migration: the methods
On a dynamic website, the database holds almost everything. Before a migration, here are the methods for backing it up, from the most manual to the most automated.
On a dynamic website (WordPress, PrestaShop, Magento, etc.), the database holds almost everything: pages, posts, products, accounts, orders and settings. Before a migration, backing it up is the first condition for being able to roll back. This article details the methods for backing it up, from the most manual to the most automated.
The database is only part of what needs to be set aside: the files, the server configuration, the existing redirects, measurement data and access details matter too. See our list of what to back up before a migration. And keep the backup away from the server: whether for a migration from PrestaShop to Magento or to any other CMS, a backup left on the server disappears with it.
Analysing the database before backing up
The first thing to do before backing up, restoring and migrating your data is to think carefully about what you have done so far for your database backup, whether or not it meets your needs. Do you know where all your data is currently stored? Is your file backup process with the current solution properly documented?
A process must be put in place to separate data relating to sensitive operations from data intended for long-term storage. And when it comes to backing up your database, is it time to make adjustments to comply with regulations?
You will also want to analyse your current hardware, bandwidth and storage system and determine whether they are suited to the requirements of your new solution. If migrating data to the cloud is new territory for you, you may need to carry out a cost analysis and significant testing.
Manual backups
Let us start with the simplest method: transfer your data yourself to your local computer using the FTP protocol. However, the disadvantages are obvious:
- You have to remember to make regular backups.
- Downloading the content of a large website can take a lot of time.
- It is impossible to download only the documents that have been modified (which costs you time and bandwidth).
- You have to monitor the download manually to make sure it runs smoothly.
- You have to work out your own logical procedure for managing and backing up files.
If you choose to go down this road, here are a few tips to get there:
- Set calendar entries and reminder notes for backing up your website and make every effort never to miss the task.
- Do not forget to back up your databases as well.
- Keep a logical folder structure, using the date as the directory name.
- Make sure you back up to several hard drives for maximum protection.
Backups with your administrator interface
The administrator control panel is easy to use. However, there are some pitfalls to avoid. First of all, let us briefly explain how to perform a backup if you are hosted on a server with the cPanel control panel installed:
- Log in to your cPanel management panel.
- Click on the "Backup" icon.
- Select "Download a Full Account Backup".
In the "Backup Destination" section, select "Home Directory" and enter your email address, then click on the "Generate Backup" button.
You will receive an email when the backup is complete. You can then export your database and proceed with the migration.
You must download the backup file to your computer and keep it in a safe place. You should remember to make frequent backups and store the backup files securely. If your backups are saved on your server and the server fails, you practically no longer have a backup.
Cloud backups
A cloud computing solution is the ideal place for backup and restore. It keeps evolving and, for most systems, it benefits from full backup and redundancy. Cloud backup and restore systems include:
- Amazon S3: the reference in cloud computing options. However, moving your data to S3 requires some attention and will require server software, provided you have access to it (for example MSP360 Backup, formerly CloudBerry Backup, for Windows users). Otherwise, many platforms have tools to transfer your information to S3. For example, WordPress users who cannot install backup software on their server can turn to Solid Backups (formerly BackupBuddy), a WordPress plugin that backs up your WordPress data to Amazon S3.
- Dropbox: Dropbox is not designed as a backup tool, but it can serve as storage space for your copies. WordPress users, for example, can use a third-party plugin that sends a backup of the WordPress installation there at a frequency of their choice.
- Manual upload: even if you do not automate your backups, S3 remains a safe and reliable place to store the backup files you upload yourself.
Rsync backups
Rsync is a piece of software that can copy files from one server to another. This solution is smart because it only transfers the files (and even only the parts of the files) that have changed. This is the principle of incremental backup: you do not copy everything every time. It saves you time and bandwidth when backing up and restoring your database.
Setting up rsync is not simple, but if you have a second Linux server under your control, it offers an excellent incremental backup system for your site.
If you go this way, you will still have to back up your database on your SQL server. If you want to use a cron job to back up your database into the synchronised part of your directory, rsync will take care of the rest. If you have a MySQL database, the simplest way to back it up is to run the mysqldump command-line utility. It is provided free of charge with the MySQL client tools, on Linux as well as on Windows. Without command-line access, the export function of phpMyAdmin, the MySQL administration tool that most hosting providers offer, produces the same kind of file.
Automated backup solutions
Why manage backups yourself when you can hand the responsibility over to the experts? There are a small number of backup managers, including:
- CodeGuard: focused on malware prevention and on alerts when your website is modified, CodeGuard offers manual and automated backups of your site.
- Dropmysite: a simple website backup solution which, like others, connects via FTP and downloads the backups. However, this program does not perform incremental file backups, but simply re-downloads the entire website.