Codex Home → Getting Started → Frequently Asked Questions → Backing Up Your Database and Files
Backing Up Your Database and Files
Backing up your database and site files on a regular basis is one of the best practices to maintain your site. Backups of the database as well as the site’s folders and files in the server are essential to recover from a disaster such as hardware failure or if your site is compromised.
There are a number of approaches you may take to backup:
Hosting control panels
If your site’s hosting provides a control panel e.g Cpanel, Plesk, or Helm, then you should have backup available as a selectable option. Log in to your control panel, locate the item, review it’s options and enable it; generally it will backup both your site files and database and it will do this as a scheduled task which also rotates the backup i.e after a certain number of backups the task will then create the next set of backups and overwrite the first ones made, this way you have backups that will cover a certain period, typically this might be a week worth, so from any given day you should have backups that cover the previous six days.
With ‘Rotating’ backups it’s worth bearing in mind that they dictate a window of opportunity in which you may recover or restore files in case of problems and as such, you need to keep a close eye on your site on a regular basis during the period your backup covers before being rotated. For example, if you have a problem on a Tuesday you have only Monday’s backup to revert to if you haven’t noticed the issue by the time next Monday comes around the good backup will be overwritten and you have lost the opportunity.
Manual Database backups
If you have a tool such as phpMyAdmin made available to you, you might choose to take a manual backup of a site’s database to download and store off site which is the recomended practice. Keeping backups in the same hardware they were taken from negates the usefulness of backups in the event of hardware failure.
A full database backup will pretty much help you recover your site in almost its entirety. For complete recovery, you’d also need to backup or download your site’s files and folders from the server. These static files includes uploaded media like images, PDFs, and other documents which you attached to your Posts/Pages.
The procedure for making a manual database backup has been well documented in the WordPress Codex: codex.wordpress.org/Backing_Up_Your_Database
WordPress Admin Dashboard / Backend Export
WordPress provides a means of exporting your posts, pages, comments, custom fields, categories, and tags.
Navigate to admin menu ‘Tools > Export’ option and select all that you want to export. Save the exported file off site. Caveat: this is not a replacement for a full backup regimen, it only backups content which does not include database information on the site configuration. This method is best viewed as a quick means of restoring a few posts that may have been lost and can’t be recovered from the posts revisions table. Under the principle outlined below that one can’t be too safe, it is advisable to use this facility from time to time. **Note this method does NOT export your BuddyPress data, but only WordPress blog entries, comments and users
Update: VaultPress is owned by Automattic. As of Version 1.0+, it supports normal BuddyPress installations.
For complete peace of mind it may be worth considering the monthly subscription to the VaultPress service which continually monitors and backs up your site, files and database, and allows very simple restores in the event of a disaster. This provides a level of security and comfort worth every penny. See: VaultPress Features | VaultPress Plans
Backup often – be safe, not sorry
Generally there is no such thing as too many backups. It’s very easy to think that you have covered the process and are safe but it is good practice to keep multiple backups that cover the same data and keep them in different locations. If possible, download your site’s folder and files via s/ftp to your localhost machine, copy those files to a secondary devise such as usb drive, NAS drive, pen drive, etc. Do the same with your database backups … keep multiple copies of them on iifferent storage locations where possible.