Albeit planned to be a substance administration framework, WordPress has been utilized in an assortment of areas notwithstanding blogging —, for example, music and web based business. Starting at 2018, WordPress sites represent 14.7% of the best 100 sites.
In the event that you deal with a WordPress site, WP Admin ought to generally be adequate. In any case, to ensure yourself against circumstances like defiled databases or hacks, you should keep reinforcements. As a standard guide, you could experience the exhortation in the Backing Up Your Database page in the WordPress Codex, which will help you in making reinforcements of your database.
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 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 next way of managing database dumps through a GUI without the use of any code is through phpMyAdmin.
If your server management is through a software tool like WAMP or cPanel, PhpMyAdmin comes pre-installed. If your server runs on a Linux-based operating system, phpMyAdmin may even come pre-installed too! In other cases, you can install phpMyAdmin by downloading its source code and configuring it. The installation page has instructions to check which directory phpMyAdmin might be pre-installed in.
When you have successfully logged into phpMyAdmin, the list of databases is shown on the left column.
Next, select the database which you want to back up. In this case, the WordPress database was named
wp. After selecting the database, select the “Export” tab.
By default, all the tables in the database are exported in the form of
SQL queries. You can select a different export option depending on your needs from the drop down list and also select specific tables for the export. However, if your primary reason to export is for backup, make sure you select only from these formats:
XML. phpMyAdmin also supports three other formats, but you should stick with these three in case you want to transfer it through some other tool. You can import a database by going to the Import tab and uploading the dump file.
At this point, it must be mentioned that by default the file size limit is set to 2MB. You’ll have to modify it in your
php.ini file and restart the server to work with larger database dumps.
At very large database sizes (say a few gigabytes), it could potentially become difficult to download the database dump through the browser and upload it later. If you’re facing such an issue, you could try the next option.
3. MySQL Command Line Dumps
In MySQL, the dump of a database can be downloaded with the
mysqldump -u [username] -p[password] [db_name] > backup.sql
In this code:
- username is the MySQL username
- password is the MySQL password
db_nameis the database to be backed up
backup.sqlis the name of the file where the backup would be stored.
backup.sql is stored in the same directory where the command is run. Notice in the syntax that there’s a space before
[username] but none before
If your username is
root, password is
test and the database to be backed up is
wp, the command translates to the following: