I have been adding quite a few posts and images to my new website. If I don’t have a backup plan, I could lose it all. If my site is hacked, I could lose it all. 4 options I have for backing up my database are: 1) pay my web host to do backups, 2) use a backup plugin, 3) do a database dump, 4) use CLI (command line interface). Today, we will look at #3.
Just like you can install Microsoft Word, games and other software on your computer, web hosts install numerous programs on their web servers to make their services work. Two of those tools come into play today: 1) CPanel, 2) PHPMyAdmin because my host is SiteGround. Some GoDaddy accounts also have CPanel, too. In SiteGround, it takes two clicks to get to CPanel, but you can also get there with a direct CPanel link.
CPanel is just a way to get to PHPMyAdmin..Note that for security purposes, none of these screenshots will show specifics of my database.
It’s good to keep in mind that PHPMyAdmin is not the database. It’s just a piece of software that allows us to work in the database.
On the left side of the PHPMyAdmin screen, you will see a list of the databases connected with your hosting account. One of the databases will probably be information_schema. Leave that one alone, it stores the settings that make the rest of your database access work!
If you have multiple databases and you can’t remember which one belongs to your main website, your software configuration will tell you. For WordPress, the database is listed in the wp-config.php file. Click on that database, and the tables will show on the right.
Once you have chosen the database to export, click the Export button in the navigation bar above the tables, and it will take you to the Export page. For most uses, the Quick method is fine. That will simply give you the opportunity to save the file to your computer. I generally change the name to something that makes sense and add the date in the m-d-y format so I can store multiple backups.
The .sql file can be opened in any word processing or text editing program if you want to look at it. Although the first time you look at a .sql file, it seems like a bunch of gibberish, if you scroll through the file you will start to notice that it creates tables and adds records. It’s a “dump” of your database!