WordPress is still relevant today, even fifteen years after its first release. It’s often the first choice that comes to one’s mind when starting a new blog.
Although intended to be a content management system, WordPress has been used in a variety of domains in addition to blogging — such as music and ecommerce. As of 2018, WordPress websites account for 14.7% of the top 100 websites.
If you manage a WordPress site, WP Admin should mostly be sufficient. However, to protect yourself against situations like corrupted databases or hacks, you should keep backups. As a standard guide, you could go through the advice in the Backing Up Your Database page in the WordPress Codex, which will help you in creating backups of your database.
WordPress supports only MySQL and MariaDB as databases, although it’s not impossible to sync other databases like PostgreSQL. This post will assume that you use the default WordPress database option — MySQL — although the steps for MariaDB are very similar. We’ll first cover the basics of the WordPress database, and then move on to backup and restore operations.
WordPress Database Basics
The WordPress database is provided to you when you’re installing WordPress for the first time. Most webmasters never encounter the database again — as every admin-related action on WordPress is performed through a GUI.
If you notice closely, you’re providing WordPress the host of the MySQL server, its username and password to create the required tables. Notice that a prefix is also supplied, which means that all WordPress-related tables would start with the prefix (in case you want to create backups).
WordPress uses the database to broadly store the following data:
- the settings of your website
- the details of users registered on your website
- the details of published posts and drafts
- tag information related to your posts
- comments on your posts (assuming you use the comment system of WordPress and not a third-party comment manager like Disqus).
Note: If you’re interested in knowing about details of various tables in the WordPress database and their function, you can refer to this guide on SitePoint.
Needless to say, keeping a backup of your WordPress directory isn’t sufficient for security purposes. The database needs to be backed up at regular intervals too.
#1 WordPress Plugin: Udraft Plus
Udraft Plus is a plugin that enables you to back up and restore your entire site, including your database. After installing and activating the plugin, you’re asked to create a backup. Once a backup has been created, you can restore from any backup points in the past.
In the free tier, you can create backups to a remote location (Dropbox, Drive or Amazon S3), as backing up within the server makes it vulnerable to server failure and attacks. The premium version comes with advanced options like cloning and migration of sites, scheduling backups and reporting.
The post 3 Ways to Back Up and Restore Databases in WordPress appeared first on SitePoint.