Backups are the lifeline of our web pages. When an unexpected disaster strikes, having a recent and available backup of the WordPress database is the difference between crying or surviving.
On this website we have talked a lot about backups. We have explained the most common WordPress problems and how to solve them thanks to having a backup.
In WordPress you have many plugins to create backups, but what you may not know is that you can create a backup of your WordPress database through cPanel.
cPanel is a tool that most hosting providers have to manage in an advanced way the different settings of your hosting. This tool is a bit scary at first, if you do not have the basic knowledge to manage it. If you touch something that you should not, you can destroy the configuration of your website and other related utilities: domains, email accounts, SSL certificates, etc.
However, if you focus on what I will explain here (and only on that), you don’t have to be afraid of cPanel. The only thing we are going to do is create a backup in SQL format of your WordPress database. And this has no effect on any settings or anything else.
The way to access the cPanel of your hosting depends on the web hosting provider you have contracted. If it’s not clear how you can access your cPanel, get in touch with them. It can also happen that they do not provide a cPanel whatsoever in the plan you have contracted. If that’s your case, ask them for access to phpMyAdmin, which is the tool we’re going to use today.
Back to the topic, within cPanel there are several different sections. The one that interests us today is that of databases:
Within this section, all we want is to access phpMyAdmin, which is a MySQL web database manager. You do not need any additional programs to access the database. Having access to phpMyAdmin is more than enough for today’s job.
Once we click on the phpMyAdmin icon, the user interface of this database manager will open:
On the left side we have a sidebar with the different databases that are created in the system. The first thing we have to do is verify which of them is the one we are using in our WordPress. If you only have one on the list, you have the job done. If not, take a look at the
wp-config.php file of your WordPress installation. You will be able to see it through an FTP client or even through the FTP section of your own cPanel.
When you are sure about the name of the database that your WordPress is using to store the data of your website, click on it in the left sidebar to select it:
Now, in the central part of the phpMyAdmin view you can see all the tables that are created in your WordPress database. This can also be used to eliminate junk tables created by plugins that you no longer use but that have been orphaned in the database.
But I recommend that you do this at the end of this tutorial, since if you make a mistake and delete a table that you still need, you will have a backup copy to recover it without any problem.
The option we are interested in today is Export, which you can find in one of the tabs at the top of the phpMyAdmin interface:
If you do nothing else and select the quick export method, executing the export will automatically download a SQL file with the backup of your WordPress database. This quick option is more than enough for any user. Of course, make sure that the chosen format is SQL, which is what your database understands.
In case the download of the SQL file does not finish correctly, it is possible that your hosting provider has some limit on the time or the amount of data it allows you to export. Get in touch with them to help you fix it.
On the other hand, if you want to refine the export of your backup of the database, you can choose the custom option. When selected, a series of advanced settings are displayed.
The first additional option you have is to select the specific tables you want to include in the backup. It is important here to indicate that you want to export both the data and the table structure in the backup.
Besides this, you can rename the tables in the export, rename the SQL file that will be downloaded, or filter those tables that are larger than a certain amount of megabytes. Usually you don’t need to change any of this, but now you know you have these possibilities.
Apart from the above, you can disable the verification of foreign keys or also export the views that you have created as if they were tables. Again, you won’t need this in your WordPress backup, but we’re here to learn, right?
What is important is that if you choose custom settings, check the setting to include
DROP TABLE statements in the backup. This will allow you to load the SQL file from the database in case you need it without first having to delete the tables from your database by hand. The backup file itself will take care of it for you, as long as it will include these statements.
Finally, you have different modifiers to choose the format in which the
INSERT statements are exported in your backup. Again, you don’t need to make any changes here, as the default settings are more than enough for you.
We have seen that creating a backup of the WordPress database through phpMyAdmin is really simple. You don’t have to be a hacker to know how to generate your SQL file with your WordPress data in case something bad happens in the future. Having this type of basic knowledge to know how to access cPanel, and from there phpMyAdmin, can save you headaches.
I hope this little tutorial is useful to you so that you don’t have to regret not having a backup of your WordPress in case some fatality occurs on your website.
Featured image by Markus Spiske on Unsplash.
Leave a Reply