Whether you’re just starting out or a pro in online blogging, disaster strikes at anytime. Good bloggers will make sure their blogs are always accessible and always online. They put processes in place to recover quickly and easily after a disaster. When we’re talking about disasters we mean a successful hacking attempt on your blogs or a sudden crash of your web servers.
So, how do you go about protecting yourself? What steps do you take to make sure that when your server crashes, you can recover in the shortest possible time?
Well, this blog post is going to show you one of the many pieces that you should focus on when putting processes in place to make sure that your blog is always online.
Most online blogs or websites are powered by content management system (CMS), like WordPress, Joomla and others. And most of these CMSs rely on databases to host its content. The most popular database server they all use is MySQL Database Server.
Now, if you’re using any of these CMS to manage your blog, there are basically two areas to focus on. The first is protecting the content database. This database contains almost all of the critical information that powers your blog.
The second area is to backup the actual blog content like images, text, themes and plugins. Those are the two areas you need to focus on when protecting your blog.
Now, this post is going to show you how to backup your blog MySQL database as well as how to restore it if you need to. To get started, you first need root access (SSH) to the server. If you don’t you may want to look at other means.
First sign on to MySQL database by running the commands below.
mysql -u root –p
When prompted, type your MySQL password. Next, run the commands below to show all databases on the server.
show databases;
You should only run the above commands if you don’t already know the name of your database. If you do, then skip the above and run the commands below to backup your database.
mysqldump -u root -p database_name > database_name.sql
A copy of the database will be saved. You can then copy the database to a remote server for safe keeping.
If you need to restore the database from a saved copy, run the commands below.
mysql -u root -p database_name < database_name.sql
That’s it! Enjoy!