Picture of a hard drive cut in half

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 graphical interface, to manage different tools of your hosting.
CPanel’s user interface, to manage different tools of your hosting.

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:

Database section within cPanel.
Database section within cPanel.

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:

phpMyAdmin is a tool for managing databases through the web.
phpMyAdmin is a tool for managing databases through the web.

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:

View of phpMyAdmin when selecting one of the databases from the left panel.
View of phpMyAdmin when selecting one of the databases from the left panel.

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:

Export menu of a database in phpMyAdmin.
Export menu of a database in phpMyAdmin.

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.

Additional settings when we select the custom option when exporting.
Additional settings when we select the custom option when exporting.

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.

Additional settings when we select the custom option when exporting.
Additional settings when we select the custom option while exporting.

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.

Additional settings when we select the custom option when exporting.
Additional settings when we select the custom option when exporting.

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.

2 responses to “How to backup your WordPress database from cPanel”

  1. Robi Erwin Setiawan Avatar
    Robi Erwin Setiawan

    Is it possible to store backup from cPanel to Google Drive automatically?

    1. Antonio Villegas Avatar

      I don’t think so. But you could try to access your MySQL database from your own computer and schedule a task to do an export and upload it to Google Drive.

Leave a Reply

Your email address will not be published. Required fields are marked *

I have read and agree to the Nelio Software Privacy Policy

Your personal data will be located on SiteGround and will be treated by Nelio Software with the sole purpose of publishing this comment here. The legitimation is carried out through your express consent. Contact us to access, rectify, limit, or delete your data.