While backup plugins are great for automatic backups, there are times when you might want to create a WordPress database backup on its own. It’s because if it gets erased or corrupted, you stand to lose everything you have written, all the content you created on your website, settings, and configurations. By performing a database backup, you can save things even when the WordPress dashboard is inaccessible.
Fortunately, it’s relatively straightforward to create a database backup using phpMyAdmin. 😎 All you need to do is export your current database. Then, when you’re ready, simply import the backup file to replace the existing version.
In this post, we’ll take a closer look at why you should back up a WordPress database. Then, we’ll show you how to back up (and restore) your database. 💾 Let’s get started!
📚 Table of contents:
Why it’s vital to backup WordPress database
No matter what type of website you run, it’s important to regularly back up your database. Most obviously, having a fresh backup on hand makes it easier to fix your site if anything goes wrong.
For example, you might add a piece of code to an important site file that breaks your website. Alternatively, if you get hacked, your site becomes vulnerable to other common security problems like SQL injections and malware.
Additionally, it’s useful to have an up-to-date backup on hand if you’re migrating to a new server or switching web hosts. Or, you might be making changes to your site (like running an update) in a staging environment.
Most users prefer to install a WordPress backup plugin to make automatic backups at frequent intervals. However, there are some benefits to manual database backups.
For instance, if you encounter a security issue like the White Screen of Death (WSoD), you won’t be able to access your dashboard to make new backups. Instead, you can create a WordPress database backup through the phpMyAdmin interface.
phpMyAdmin is a software that enables you to manage 🔧 your MySQL database easily. While you can use it to back up a WordPress database, you can also edit its tables, rows, and fields. Plus, you can import, export, and delete data here.
How to create a WordPress database backup using phpMyAdmin
Now that you know why it’s important to back up your database, we’re going to show you how to back up a WordPress database. First, you’ll need to access phpMyAdmin through your web host.
So, log into your hosting account and navigate to the Databases section. Alternatively, you can often access phpMyAdmin from your cPanel dashboard.
In this instance, scroll down to Databases and click on phpMyAdmin:
Once you can see the phpMyAdmin interface, click on Databases:
You may see multiple databases at this point, so select the one that holds your WordPress data. This will be the database that you created when you installed WordPress.
If you’re not sure what that database is, you’ll need to go into your wp-config.php file and check the database name there. Look for the following line:
Now, you should be able to see all your WordPress tables. Here, click on the Export tab:
You can choose to export your database using the Quick method or the Custom method. If you choose Custom, make sure SQL is selected as the Format. Meanwhile, check that all database tables have been selected.
Now, in the Output section, check the box that says Save output to a file. Then, use the Compression dropdown box to select None (unless your database is very large):
Under Object creation options, you might want to check the box that says Add DROP TABLE if you want to overwrite your existing database. Or, select IF NOT EXISTS to prevent errors during restores.
Lastly, click on Go to complete your database backup. At this point, all your WordPress data will be saved to your computer.
How to restore a WordPress database using phpMyAdmin
Now that you know how to create a WordPress database backup, you might be wondering how to restore the database using phpMyAdmin. In this instance, you’ll replace your current database with the backup that you created in the previous section.
Again, you’ll need to open phpMyAdmin which you can do through your web hosting account. Then, select Databases and click on the database where you want to import your backup.
Here, click on Import:
In the File to import section, select Browse and locate the backup file that you created earlier. Then, under Format, use the dropdown box to choose SQL:
Lastly, click on Go to complete the database restore. However, it’s important to note that this process can take some time, especially if your database is very large. Generally, the process can take up to even ten minutes for very large sites.
It’s important to back up your website regularly in case you run into unexpected issues. Additionally, it’s helpful to learn how to create a WordPress database backup manually when you can’t access your WordPress dashboard.
Even if you’re a complete beginner, the process is pretty straightforward. All you need to do is log into phpMyAdmin through your hosting account. Here, export the database to your computer. Then, when you want to restore the database, open phpMyAdmin and import the backup file. 💾
Do you have any questions about how to create a WordPress database backup? Let us know in the comments below!