Backing up your WordPress site regularly is a crucial thing to do. You can use the latest backup files to restore your site just in case something bad is happening to your server. Speaking of backup, there are lots of WordPress plugins that allow you to set scheduled backups. However, for a certain reason, you might prefer to backup your WordPress site manually. This post will show you how to manually backup a WordPress site.
There are two main components you need to backup: the WordPress database and the entire files under the root directory of your WordPress installation.
1. Backup WordPress database
WordPress requires a database to work. You have created this database when you were installing your WordPress site. This is the database you need to backup. WordPress itself uses MySQL as its database management software (DBMS).
What if you forgot the name of database used by your WordPress site? You can figure it out on the wp-config.php file. You can find your database name on the “define(‘DB_NAME’, ‘database_name’);” line. Following is the example.
To make it easy for you to backup your database, you can install phpMyAdmin. It’s a GUI based tool to manage MySQL databases. Most control panels like cPanel and CentOS Web Panel already have phpMyAdmin so you don’t need to install it anymore. Follow the steps below to backup your WordPress database using phpMyAdmin.
- Open phpMyAdmin and select your WordPress database on the left panel.
- Click the Export tab.
- Leave everything default and click the Go button.
Your database will be downloaded in SQL format.
In addition to phpMyAdmin, you can also use mysqldump to backup your database. mysqldump itself is CLI-based tool that runs on Linux. You can use this tool if you have a terminal access on your server. Run the following command to backup MySQL database using mysqldump.
mysqldump -u root -p wordpress > wordpressdb_back.sql
If you are asked to login as root, add the “sudo” prefix to the command above.
sudo mysqldump -u root -p wordpress > wordpressdb_back.sql
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 .sql extension.
2. Backup WordPress files
The next component you need to backup is the entire files under the root directory of your WordPress installation. In most cases, root directory has the path of /home/domain_name/public_html. Copy all files under this root directory, including folders.
Some web hosting providers have a policy that restrict you to download files in a large size. If the total of your WordPress files is larger than the allowed maximum size, you can use an FTP tool to download them. In this example, we will show you to backup WordPress files using WinSCP. If you are a Linux or Mac user, you can use FileZilla. It is pretty similar to FileZilla.
- Assuming you have installed WinSCP, launch the app. Enter your host name, username and password on the available fields and click the Login button. Make sure to select FTP on the File protocol section.
- Specify a local folder (left panel) where you want to store your WordPress files to and drop the WordPress files from your server (right panel).
WinSCP will calculate the total size of your WordPress and download them to your local storage.