Your website is your asset. Making a backup of your website is crucial since you will never know what are going to happen in the future. If your website is built with WordPress, there are a bunch of plugins to ease your job in backing up your website regularly. If you are not sure about how a WordPress backup plugin works and prefer to perform the backup manually, this article will show you how.
In outline, there are two main components of your WordPress site that you need to make the copy of. The components are the database and the whole files under the root directory of your WordPress site. The size of those components can be vary depends on how many posts you have on your WordPress. As example, a WordPress site with around 500 posts will have a 27 MB of database, while the total size under the root directory of WordPress site is about 640 MB.
Here is the step by step to backup a WordPress site manually without plugin.
WordPress uses MySQL as the database. You will be asked to create the database when installing WordPress. What if you forget the database name? Not a problem. You can check it on the “wp-config.php” file of WordPress. So, open this file and look for the “define(‘DB_NAME’, ‘wordpress’);” line. On the example of screenshot below, the database name is “wordpress”.
There are several tools you can use to backup a MySQL database. Today, most web hosting services come with phpMyAdmin to makes it easy for you to deal with databases. In this article, I am going to show you how to backup the database using two tools, phpMyAdmin and mysqldump (command line-based).
1. Using phpMyAdmin
- Run phpMyAdmin and select (click) the WordPress database on the left panel.
- Click the Export tab.
- Leave everything default and click the Go button.
2. Using mysqldump
mysqldump is a command line-based tool. You can only use this tool on Linux. This tool is better suited to backup your database if you install your WordPress site on your own server (or VPS) instead of shared hosting. You will only need to run a single line of command to use it. Like the following.
mysqldump -u root -p wordpress > wordpressdb_back.sql
If you are asked to login as root, add the “sudo” prefix to the command above. You can tailor the file name of the database from the exporting process (“wordpressdb_back”) with your preferred one. Just don’t forget to include the
Backup files under the root directory of your web server
Some web hosting services apply a policy that restrict you from downloading files in a large number. This can be a little problem if your WordPress already have hundreds of articles since the total file size you are going to download must be large. But don’t worry, you can download the files using your FTP account. To use the FTP protocol, you need a FTP client. In this article, I use FileZilla.
Below are steps to copy all files under the root directory of your WordPRess site. By the way in case you didn’t know, root directory is the directory where your WordPress files are located.
- Enter to the root directory of your WordPress site and create a new folder.
- Copy all of the files in the root directory (with no exception, including the folders) to the folder you have just created.
- Create an archive of that folder.
- Run FileZilla and login with your FTP account. If you haven’t used this tool before, you can refer to this article.
- Select a folder on your computer (left panel) where you want to download the archive of the WordPress files.
- Select the archive of your WordPress files (right panel). Drag it and drop to the directory you have specified on the left panel.