Backing up your WordPress site is crucial enough, especially if you use it for business. There are two main components you need to backup, all files under the root directory of your WordPress site and the database. This article will show you how to backup the second component.
WordPress uses MySQL as the database management system. The WordPress database consists of several tables that connected each other. To backup the WordPress database, you have to know the name of the database used by your WordPress site. You created this database when installing your WordPress site. What if you don’t remember the database name?
Don’t worry, you can check the database name on the
wp-config.php file of WordPress. So before you get started to backup, be sure you have the access to the WordPress files and also database.
Checking out the database name
To check the name of database used by your WordPress, you can open the
wp-config.phpfile. Search for the “define(‘DB_NAME’, ‘wordpress’);” line. In my case, the name of the database is “wordpress”. This is the database you are going to backup.
Starting to backup
As I said, WordPres uses MySQL as the database management system. There are two common methods of how to backup a MySQL database, using GUI-based tool and using CLI-based tool. phpMyAdmin is a popular GUI-based tool to manage MySQL databases, while mysqldump is a popular CLI-based tool you can use to backup a MySQL database. This article will show those two methods.
Backing up WordPress database using phpMyAdmin
If you install your WordPress on a hosting service, you can use phpMyAdmin since nearly all hosting services have this feature.
- To get started, run the phpMyAdmin on your hosting service and select (click) the WordPress database on the left panel.
- Next, click the Export tab.
- Leave everything default and click the Go button.
Backing up WordPress database using mysqldump
If you installed your WordPress site on your own server (or VPS, may be) and didn’t install phpMyAdmin, you can use mysqldump. It’s a CLI-based tool to backup MySQL databases. It’s have been installed by default on most Linux distributions. Run the following command to backup your WordPress database using mysqldump.
mysqldump -u root -p wordpress > wordpressdb_back.sql
You can tailor the file name of the database from exporting process (“wordpressdb_back”) with your preferred one. Just don’t forget to include the
.sqlextension. Your database will downloaded in the current path where you run the mysqldump command.