Any computer savvy person knows its best to always ‘backup your work‘. Unfortunately, sometimes even we forget. I sometimes catch myself saying “I need to back this up..I’ll do it later”… Yeah well this very blog you are visiting almost didn’t survive this weekend. ‘What had happened was..’ I was performing some cleanup on my webserver deleting old files..blah blah..which also included old databases that are no longer used. I accidently dropped the wrong database, Oops! Fortunately my host has scheduled filesystem and database backups, but even that may not be the most recent data, especially if I upgraded after the last backup or added new content.
I decided to create this post to help remind others who use WordPress or really any other application that is using a SQL database to back your data up. I did some ‘googling’ (I wonder if that term has reached to Dictionary yet
) and came across a blog post describing how to back up your SQL database through the phpMyAdmin Console. I am not going to re-post what I feel is already a perfectly simple breakdown on how to backup your WordPress database. I am just pointing you in the right direction.
First of all whenever you start to perform an automatic backup in WordPress you are given this reminder to backup your database. Trust me, click? on the link that you are provided prior to upgrading. You’ll be glad you did. The link will direct you to a webpage describing how to back up your WordPress database. The instructions are straight forward if you have access to your SQL admin console, otherwise you will need to contact your web host support. Here is the webpage that helped me which contains the same instructions, http://codex.wordpress.org/WordPress_Backups.
As I stated earlier I am not re-posting the backup instructions because it has already been posted perfectly as is from the link I provided. However, I will add something that is missing which may be minor to some but important to others. They left out how to configure the naming convention for your SQL dump (the backup .sql file for your database). This is important to me because I want to know the version and date of the backup I downloaded.
When you are at the point of executing the backup of your database, go to the ‘Save as file‘ section located at the bottom of the MYSQLAdmin console. See screenshot below.
In the File Name Template field you will have a predefined naming convention as __DB__. This basically will output the name of your SQL backup as <DATABASENAME>.sql. As you can see that is too simple and does not help identify how recent your data backup is. There are additional parameter strings you can add to generate the filename. Please refer to the php.net Manual for Date/Time Functions. This is what I used and may just as well work fine for you also.
In the File name template field: __DB__-%F-%R
This will generate the filename with 24hr timestamp as <DATABASENAME>-<YYYY-MM-DD>-<HH:MM>
Example: dbtest-2009-12-20-03:03.sql
That’s it!? Restoring your database is just as simple as importing your .sql file. See Restoring Your Database From Backup.








Leave a Comment