So, you want to know how to backup and restore WordPress. Most webhosting services do make complete backups of the entire server, but it can take a fair amount of time to reconstruct your site from the webhost backups and if you ever need to restore, you will probably want to do it quickly. The solution to that is do regular backups yourself. These backups can also be used to migrate your WordPress installation from one webhosting provider to another.
WordPress keeps much of its information in a MySQL database rather than in files, though you need to backup both the database and the files. For example, the text of your posts are all in the database. Much of this database information is stored as ‘serialized’ php objects. For a straight
database backup (and restore), you can use a database manager program to execute a database dump. phpMyAdmin is an example of such a program that is often available on your webhosting service.
A database ‘dump’, despite its shabby name, is a series of executable database programming statements. phpmyadmin can execture these statments to recreate the database structures and data if you need to restore your site. When you run phpmyadmin to make a backup, you’ll use the ‘export’ function. There are a number of options that you’ll need to set in order to create a database when you restore you WordPress site.In order to get a database dump in phpMyAdmin, you need to know the name of the database used by your mysql installation. You will also need to know the password and userid for loging into phpMyAdmin. If you don’t know these, ask your webhosting service for them.
In phpMyAdmin, you first switch into the database used by WordPress, and then go to the ‘Export’ menu. On the systems I have encountered, the ‘quick’ options for the phpMyAdmin export have not needed to be changed. So, you would click on the Export functionn’s ‘go’ button and that would create and download an ‘SQL‘ file to store on your local computer. This is your database backup.
To restore your database, use the phpMyAdmin ‘import’ function. Just use the browse box to locate and upload the SQL file you saved in the previous step.
There are also some files associated with your site, including WordPress program files, themes, plugins and uploads. A backup of these item is made separately from the database backup. You may use an ftp client or the like to download those files directly to your local hard drive.
I use a file manager that comes with my hosting account that is accessible from cPanel. Using that file manager, I ‘compress’ the ‘public_html’ folder in my webhosting account. This creates a ‘zip’ or ‘tar.gz’ archive in my home directory on the webhosting server. Then I use the file manager to download that file to my local hard-drive.
To restore, I upload the archive to my home directory on the webhosting server and ‘extract’ the archive. That will recreate my public_html folder from the archive.
These backups are ‘complete’ backups as opposed to incremental backups that your webhosting service might do. Your complete backup can restore your site very quickly, while it may take the webhosting service some time to restore from its backups.
You should also be aware that there are several plugins that handle backup and restore tasks. I’ll cover some of those in later articles. I’ll also cover migrating your WordPress site.