Imagine the following scenario: ”A critical damage occurs to the server on which your website is hosted. Then, there’s a terrible data loss, and you cannot recover your site. Or is it a customer’s website which you have spent hundreds of hours to design and maintain?“ If your response was “No way! These things don’t happen!”, then welcome to my world! My hosting provider company was hacked just a year ago, and I had to build almost 15 websites from scratch.
This must have got your attention. If it hasn’t, keep having your websites unprotected. If it has, however, get ready to learn how to avoid such a disaster. It all goes down to backing up the database of your WordPress site so that you can restore it if anything similar to the above happens. In this guide, you’re about to learn how to back up your WordPress website database quickly and safely. Enjoy your reading!
What is a database? How is my WordPress site connected to it?
A database is the backbone of your site. Period! It’s not the theme it uses, neither the plugins nor its widgets. It is the database (also known as SQL database) which stores every significant component of your site; i.e. your posts, pages, comments, users, passwords, etc. Losing your database means losing your site entirely. So, having frequent database and files backups ensures that your website will make it to the end of days.
How can I back up the database of my WordPress site? What are my options?
There are a variety of ways in which someone could back up the database of their WordPress website. Some simple commands allow this, some WordPress plugins do the same, and some programs specifically designed for this purpose can do the same thing as well. Each method has its pros and cons. Let delve into them to see which is the best for you. No matter which way you choose, however, please keep in mind that it is of utmost importance to maintain the backup at a local storage unit (i.e. a hard disk of your computer) instead of keeping it online on the same server that hosts your site or sites. This way, you guarantee that no matter what might happen to your server or your site, your database will be safe.
Option No1: WordPress database backup using MySQL commands
If your site is hosted on a Linux server or a server that allows you to have ssh access, then the process of backing up the database of your site is relatively easy.
Step 1: Log in to your server/account
Step 2: Choose the folder (better said directory) in which you want your database backup to be stored. Use the cd command to navigate to the folders of your account.
Step 3: Use the mysqldump command to back up your database. To do this, just type the command followed by the name of your server, your username, and the name of your database. The command should look like this:
mysqldump –add-drop-table -h the_name_of_your_host_server -u your_mysql_username -p the_name_of_your_database.
There are many variations of the command presented above, but we will try to keep things as simple as we can for you. Feel free to experiment, with this useful command, though. You can, for example, create a backup of all your databases at once. Just type the following command:
mysqldump -u root -p –all-databases > The_name_you_want_to_give_to_your_backup.sql
Step 4: After you’ve created the backup of your WordPress database or a backup of all your databases, you have to use an FTP client such as FileZilla or WinSCP to transfer this backup to your local drive.
That’s it! Your database backup is created, and it lies entirely safe in your computer. It wasn’t difficult, was it?
Option No2: Use a WordPress plugin to back up your database.
Our favorite plugin for the purpose of backing up a database of a WordPress website is the “WP Database Backup” plugin. The fact that it simplifies the process of backing up your database to a great extent and the fact that it is 100% free are the main reasons justifying the popularity of this plugin. WP Database Backup has over 50000+ active installs as of writing this guide. To install and use it, follow these easy steps:
Step 1: Log in to your WordPress Dashboard
Step 2: Navigate to Plugins > Add New
Step 3: Locate the search box at the upper right of your screen. Type “WP Database Backup” in the search box and hit Enter.
Step 4: Locate the plugin, install, and activate it.
Step 5: After the plugin is activated, navigate to Tools > WP-Db Backup.
Step 6: Do you see the blue “Create New Database Backup” button at the top of the screen? Click on it, and your database is created.
Step 7: Click on the Download button that appears next to the description of your database, and download the backup to your computer.
Voila! You’ve just backed up the database of your website in 30 seconds, flat.
There are more cool things about the WP Database Backup plugin, however. It can also help your restore the backup of your database in case something goes wrong with your website. Furthermore, the free version of the plugin offers a scheduling option that allows you to back up your database automatically. Aren’t you satisfied yet? OK! What if the plugin allowed you to receive any backups it creates via email or let you store them online on Google Drive, Amazon S3, or Dropbox? Well, it does! Free, of course. Just navigate to the settings page plugins using the Scheduler, Settings, and Destination Tabs.
As you can see, using WP Database Backup is a surefire hit when it comes to backing up your database. Rarely a free plugin offers so many features. There’s also a premium version of the plugin which is called “WP All Backup Plugin.” This premium version allows the backup of your entire website in a matter of some clicks. If you wish to purchase it, the free version of the plugin offers a coupon for a 27% discount for the premium plugin. A great investment in the safety of your work, don’t you think? To visit the web page of the premium plugin, click here.
Are there any other useful plugins for backing up my WordPress Database or site?
Of course, there are. In fact, plugins that allow you to back up your database, as well as your entire site, are so large in numbers that we can hardly choose some of them to mention. We have compiled a list, however, to give you an idea of what is available to you.
• UpdraftPlus WordPress Backup Plugin: It’s an all-inclusive option which allows you to back up both your WordPress files and your database to allow an easy restore, should anything detrimental happen on your site or server. Despite the fact that the premium version is much more functional than the free one, the latter should suffice for basic and intermediate website owners.
• WP-Db-Backup: Similar to the “WP Database Plugin” we’ve presented above with a huge fan base. In fact, there are more than 400000+ active installs. Our only concern is that the plugin hasn’t been updated by its creators for 7 months so far.
• BackupBuddy: Another all-in-one solution. In fact, this plugin is considered by many admins as the flagship of backup plugins. You can use it to backup all your WordPress files and databases with ease. This is a premium plugin with many pricing plans. What is different about this plugin, though, is the fact that it is not a subscription based plugin. You have to make a one-time payment to get the full lifetime access version. Its price might be a little high, but purchasing this means that you cut down on any future and recurring costs.
OK! I have backed up my database! How can I restore it to fix my WordPress database problems?
If you chose to follow our advice and use the WP Database Backup plugin, you must have noticed that the plugin provides a database restore feature which simplifies things a lot for you. If you decided to go down the mysqldump road instead, you could use the mysql command to restore your backup. You can find more information on how to do this, by reading the original WordPress codex about this issue. You can get the page here.
This concludes our guide on how to back up the database of your WordPress site. You should know by now that maintaining frequent backups of your database ensure the safety of your site. You’ve also learned how to create database backups using simple MySQL commands. Also, you’ve learned everything there is to know about the WP Database Backup plugin. It is a very useful plugin that not only backs up WordPress databases but it also does that automatically, and stores them to online storages or your computer. Last but not least, you’ve known some additional plugins designed for the purpose of backing up WordPress databases and WordPress sites. Regardless of the option that you choose, make sure that you always have a local copy of your database on your computer. Just in case!
We really hope you’ve liked our guide. Hurry up now! Create backups of your databases as soon as possible.
Thank you for reading!
P.S.1. If you are a PHPMyAdmin fanatic, this guide might not be for you. We’ve tried to provide only easy methods of backing up WordPress databases. You can, however, visit the following link for a thorough guide on how to use phpMyadmin to back up your database: https://codex.wordpress.org/Backing_Up_Your_Database
P.S.2. Please share this guide with any WordPress user who you care about. Help them avoid tons of frustration and desperate hours.