Weary of backing up your WordPress site due to over-frequent updates? WordPress updates are coming up too often, and you never know what you’re really risking whether you do the update or not! This is why backing up the current working state of your WordPress blog or web site is essential. If you are a subscriber of the pro version of JetPack, or a user of a back-up utility plugin for WordPress, you might be doing just fine. But if you are reluctant to opt in for a paid tool or service like JetPack Premium or Professional, and not quite trusting to WordPress plugins which might get broken themselves for various reasons, including a possible unavoidable automatic version update of either PHP from the web host itself or an automatic WordPress update (the latter occurs as often as every other week) incompatible with the PHP version or settings of your web hosting server, then this article might be just right for you.
Case study: Maclord’s Mac Blog. This blog has been out there for about a decade now since the early days of WordPress when it was at version 2.x. It became out of order a couple of times due to poor maintenance, and the temporary abandoning of its owner because of getting fed up with maintaining WordPress rather than focusing on writing. Maclord had made a good start back in 2008, but after 2 years, it was left untouched for a long time. Incompatibilities between the version of PHP on its server and the version of WordPress versus some outdated plugins (which functioned just fine if neither WP nor PHP were not updated!) caused the entire site to come down with subsequent automatic and incompatible component updates, and yet, there was no proper back-up plan.
Today’s successful WordPress blogs and sites are not just those that overcome writer’s block and publish valuable articles, but also those that endure the continual change in software, and the underlying technology with a persistent commitment to its maintenance at the same time.
So what do we do when we see a news headline like the following?
WordPress 4.8.1 is available! Please update now.
Backing up your database in three easy steps:
If you prefer to get things done quickly, and practically with GUI-based (i.e. Graphical User Interface) easy-to-use tools, that’s where Navicat comes exceedingly handy in accomplishing anything database-related. Of course there are other tools like phpMyAdmin available for free for those who are a bit more ‘techie’, and who wouldn’t mind getting past the learning curve to get used to the tool. However Navicat is one of the few tools which helps get things done in fewer steps with a few clicks, and it is extra handy when you are managing multiple databases on different servers and locations – an extra bonus score especially if the database servers consist of a set of heterogeneous platforms.
Scenario 1 – Dumping an SQL file of the entire database with structure and data
In this scenario, we will use Navicat for MySQL version 12 to directly to connect to the database on the hosting server, and then obtain a complete database dump with a couple of clicks. You can see from the screenshot below that I had the connection settings already defined before, so all I need to do is to double-click the connection name. For a step-by-step demonstration of how to define a database server connection on Navicat, visit our blog article How to define a remote server connection in Navicat to your WordPress blog’s MySQL database on your web host.
Right-clicking the database name or selecting the Database menu, and then selecting Dump SQL file… > Structure + Data will bring up a prompt asking a file name and location to save the DDL and the data to a local drive.
Scenario 2 – Backing up the database using Navicat’s built-in Backup feature
Navicat has always had its own backup/restore scheme, which is very practical. The look and feel of backup/restore section in Navicat’s GUI might cause a perception that the backed up data is stored on the database server, however it is actually stored on the local computer where Navicat is installed. It is always possible to have Navicat show the backed up data in the file system, which is the Finder on macOS, and Explorer in Windows.
After the operation is successfully completed, you will the see the backup file automatically renamed to the current timestamp. Right-clicking it will open a contextual menu presenting options such as deleting, duplicating, or restoring the backup file as well as showing it from its location in the file system of the operating system you are using.
Backing up WordPress site Files
Scenario 1 – Backing up Files using cPanel’s FileManager
In this scenario, you will see a practical way of backing up your files, using the web-based file manager embedded in cPanel. In the case, I will demonstrate how this can be done using HostGator‘s FileManager on its cPanel.
First of all, we need to log in to the account and reach the home page which I could call the dashboard of the cPanel user interface:
Next, we will get into the FileManager which is accessible either from within the Popular Links, or via the Files section.
In the File Manager, I will select the directory of the WordPress installation and click Compress to bring in a modal dialog box prompting where to compress the entire directory (folder) into a single archive file and in which format (generally to choose between a Gzipped tar archive or simply a zip file).
After specifying the file name and path and clicking the Compress File(s) button, an archive of the entire folder/directory in the specified format (in our case it is tar.gz) will be created with a server-side operation (which is extremely fast and efficient I might add).
Finally the entire file and folder structure and contents of the WordPress site or blog (or whatever web site) will have been backed up in the file system of the server. We can then take a couple of extra steps to download the compressed backup archive to a local machine such as the computer desktop. Refer to the screenshot below:
If needed, the compressed archive can be extracted by clicking the Extract button after getting selected with a single click, and a similar dialog box will appear to complete the process.
Scenario 2 – Backing up Files using a Command-Line Terminal via SSH (alternative method to the above)
For those of us who prefer to get things done much quicker via typing only a few commands, using SSH via a command-line terminal comes in handy. If you are on a Windows machine you will need a Terminal client such as PuTTy (free download). If you are on a Mac, you can use the built-in Terminal which comes with every Mac. In this scenario, I will connect to a mirror server via SSH which resides in one of the data centers of Dreamhost in the USA.
After opening a terminal session via an SSH connection, and changing the directory to the appropriate path, all we need to do is to type in a command like:
tar -zcvf maclord_dh_bak.tar.gz maclord.ozar.net
And there we go – the entire folder is compressed and saved in a gzipped tar archive.
In the event of a need to restore this backup, all we need to do is to untar the archive by executing a command like:
tar -xvf maclord_dh_bak.tar.gz