It can be a little confusing when techies start talking in languages you just don’t understand. With all these parts that make up your website – domains, web hosting, WordPress, databases, PHP – it’s really easy to get overwhelmed and just give up.
Recently I had a chat with a very avid blogger friend of mine – Jennie Gorman. After explaining WordPress backups and how databases work, she told me that she believes this is something that more business owners need to understand. Hopefully you get a little something out of this as well.
This post is a series of posts to help you better understand the workings of your website so you can make sense of all that tech talk. Today’s topic is databases. If this is still too techie for you, let me know and I’ll update the post.
A Content Management System
If you are able to log in and change parts of your website easily, chances are that you also have a database. WordPress gives you this ability, and falls under a category of software called a “Content Management System”. That means it gives you the ability to make changes to your website without having to change any actual files.
When someone visits your website, they are connecting to a computer (web server) somewhere which holds at least two things – a bunch of files and a database.
There are two types of files. There are “static” files, like pictures, PDF’s, documents and other normal files that you would find on your own computer. The rest are just lines of code. Lots of them. They contain instructions for the web server on what to do when it needs to display your website to your visitor. Together, these files contain the information for:
- The layout of the website e.g. show your logo first, followed by a menu, followed by picture, etc
- The style of the website e.g. colours, text sizes, borders, etc
- Pictures, documents, downloads
- Instructions on where to find the current page in the database
All these files together are what you would call your Content Management System, or in this case, WordPress. This is also where your theme and plugin files live.
Right now you have visited a specific web address to read this post. Based on that address, WordPress knew that it needed to go into the database to dig out these actual words you are reading.
So what is a database?
The easiest way to think of a database is a bunch of tables, just like Microsoft Excel.
All your WordPress posts are stored in a table. If you were to view it, it might look a little something like this:
Looking at the above table, WordPress would have seen that you are looking for post with an id of 3. It grabs that row out of the database, displays the title at the top of the page, and all the words from the post column right here. Each row is just a new post.
Pretty simple when you look at it like that, huh?
The point of the id column is so that there is a unique way to identify each post. If you change the title, it won’t break anything because it will still be post number 3.
There will also be other columns that have other information. Things like:
- The date it was posted
- The user who created it
- If it is public or private
That is about as simple explanation of a database that you can get. Basically everything you see in your WordPress dashboard lives in tables like this. Some other examples are comments, settings, users etc. They all just get their own table.
In reality, all this information is stored in special data structures that would look like a giant mess to most people. Databases are full of enormous complexity that would require an entire blog to explain everything that goes on inside. Obviously, way beyond the scope of this post.
What you need to know is that at a simple level a database is a bunch of tables managed by some software on the web server, and that your database sits completely separate from the files that make up WordPress.
How it relates to WordPress backups
As we have seen, there are two parts to a WordPress site. The files that make up WordPress (including your themes and plugins) and the database that sits behind it. It’s also worth nothing that themes and plugins may create their own tables inside the database to store information.
If you were to back up your website, it is not as simple as copying the WordPress files somewhere. You now know that you need the database as well. Unfortunately, you cannot backup a database just by copying some files. However, you can take the current state of the database and turn that into a normal file.
If you have ever backed up your WordPress site (if you haven’t, remind me to smack you later), you’ll notice options to do a “complete backup” or a “database backup”. If you request a complete backup, this is what happens:
- A command is run to take a snapshot of the database and turn that into a file
- Gather up all the WordPress files
- Squash it all down into a compressed file (like a “.zip” file, but on most web servers they will be a “tar.gz” file)
If everything is set up correctly, once you download that single file, you have a copy of your entire website which you can restore on another web host. You can also use it to restore your site to a previous state in the event you get hacked or completely break your site.
Backing up regularly can be a massive pain. Some people have the backups stored on their web host. This is fine when you need to recover from a broken site, but what if your whole web host went down?
Another option is to regularly log in, create and download the backup. But who has time for this?
These days, one of the best solutions is to set up automatic cloud backup of your website. This means that WordPress will regularly backup your site, and ship the files off to a server on the cloud somewhere which you can download when you need them. You can also restore your site directly from that cloud server, without having to download the backup and upload it to your site.
And finally, the easiest method of all is to have someone else handle it all for you. Recently, I became aware of how many business owners rely on WordPress for their day to day business, yet are not backing up their site. Before I mentioned the blogger friend of mine. Last week, she told me about how she lost FOUR entire websites sue to a web host crash. Completely gone, overnight. How awful is that?
It doesn’t need to be like this, as having your backups and maintenance managed is such a simple and inexpensive process. We now offer WordPress backups and maintenance as a service to our clients, to give them peace of mind, knowing their entire site is safe at all times.
If you’re interested in not only ensuring that you won’t lose your entire website overnight, but having someone regularly service and maintain your website for speed, security and more, check out the plans at the WordPress Backups and Maintenance page.