The Perfect Hands-Free Database Backup

gmail-wp

Most of us are quite lax when it comes to making regular backups of our database. It’s too much hassle, and “what are the chances it will happen to me?”

But what if your backup system happened automatically everyday, stored the backup securely on another server, and you never had to look near it?

1 – Register a New Gmail Account

Gmail offers 7GB of storage, and up to 20MB file attachments (The largest attachment size I was able to find for a free email account). It’s free and it’s completely distinct from your regular hosting, so if your host loses everything, you won’t have lost your backups.

Go to http://mail.google.com/ and hit the “Sign Up For Google Mail” button. The form only takes a minute to fill out and now you’ll have 7GB of free storage space.

2 – Install the Plugin

There are several different backup plugins out there, but we’re going to use WP-DB Manager, because it’s the one I know will work, and because you can count on it being updated with each WordPress release.

Download the plugin, upload it to your plugins folder, and activate it as usual.

You then have to browse to the wp-content/backup-db folder, and upload the .htaccess file from the plugin folder.

If the backup-db folder doesn’t exist, create it and CHMOD it to 777 (In most FTP clients, you can CHMOD a folder by right clicking it and choosing “CHMOD” or “File Attributes” etc).

3 – Configure The Settings

A “Database” link will be added to your admin panel’s main navigation. Click it, then click the “DB Options” tab.

In the Automatic Scheduling section, choose every day, Gzip Yes and enter your Gmail address. Now hit “Update Options” and you’re done.

db-plugin

4 – Lycos Mail, for When Your Database Is Too Big

The drawback to the method above is that you’re limited to a maximum database size of 20MB.

WordPress tends to take up very little space, and Gzipping the file will help immensely, but if your blog does grow over the 20MB limit, you’ll have to find a better email account.

In that case, try Lycos Mail. They offer 3GB of free storage, but unlimited email attachment sizes.

However, with the free version, you must login every 30 days, or they will permanently delete all of your emails. You can avoid the Lycos deletions by purchasing Account Preservation, which costs $5.95 a year (Still extremely cheap!).

Losing all of the emails in the free account is too scary a thought for me, so I’m sticking with Gmail for as long as possible.

Share

  1. Hmm, i’ll try it. Better get prepared by backing up the database daily. Thanks for the tips.

  2. adam (18 comments)28 July 08

    As far as the size of the database, it would be great to delete spam comments before backing up, as they take up a ton of unnecessary room.

  3. redwall_hp (134 comments)28 July 08

    Interesting idea. Maybe I’ll set up a dedicated email account in my Google Apps system to do this…

  4. Michael (18 comments)28 July 08

    I am doing exactly this with another plugin (WordPress Database Backup) for more than a year now. It works like charm and is much simpler than the DB-Manager mentioned here.

  5. Michael Martin (1286 comments)28 July 08

    Permana,
    It doesn’t take long to set up, and you’ll definitely be glad when it’s done.

    Adam,
    That’s a good tip. I delete my spam comments each morning, just out of habit. I’ve never thought of doing it for the database though. Good idea!

    Redwall,
    Google Apps system? How do ya mean? :)

    Michael,
    Looks like a good plugin, thanks for sharing. I knew there were others that could do it, and quite possibly better!

    I only used DB-Manager as the example here because it’s the one I use, so I can vouch for it working, and the plugin author has a load of plugins and updates them all regularly (And has done for years). One’s probably as good as the other. They just make backups! :)

  6. Thanks Michael for sharing the excellent technique.

    My webserver does take a backup every night automatically. But this seems like a good tip to implement in case the hosting backup fails.

  7. Grant (13 comments)29 July 08

    Wow, this is a great plugin. TBH I rarely back up my online DB mainly because my host do it daily, but i suppose its a extra comfort knowing it will be email to me. Nice find!

  8. I have my websites do this daily and have for a while. I also setup a filter in gmail to automatically archive it since it goes to my regular email address I use for other things, this way it’s out of my way and I never see it; but I know it’s there :)

  9. Michael Martin (1286 comments)29 July 08

    Ankesh,
    Some webhosts do a great job with their backups, but even the best can get unlucky sometimes. The database is too valuable to leave entirely to them I think.

    Grant,
    It’s a nice “just in case” measure to have in place. :D

    Mike,
    Google really do give a massive amount of email storage! I put it in a separate account for convenience sake, but they give so much space, sending it to your main account still won’t put that account in danger of crossing the limits! :D

  10. Michael, thanks for putting this up. I need to go back and check to see whether I’ve got it right. Highly useful.

  11. Oh man… I just installed this on both of my blogs, set everything up, and got my first email backup in about 2 minutes. This is the best thing ever! Talk about peace of mind…

    Now if backing up several hundred gigs of photos was only so easy.

  12. Michael Martin (1286 comments)30 July 08

    Easton,
    Glad you found it useful!

    Brian,
    I know what you mean. It’s great to know that the fruits of all the long hours of work you’ve put into your blog aren’t in danger of disappearing anymore.

    Not sure if this will be any use for that amount of data, but I use Syncback (The free version, about half way down the page) for my computer backups.

    It only copies over files that have changed since the last backup, and can be set to run automatically each night if you want. Not hard to set up either. :D

  13. Michael (18 comments)31 July 08

    This is a great tip, I’ve heard of people doing things similar to this but for some reason your post actually compelled me to set it up.

  14. jiimiona (2 comments)9 August 08

    I can’t think of anything better )

  15. I knew there was an easier way to backup! Thanks for the tip, at least now I know my databases are relatively safe and backed up! Now I’ll need to learn how to restore

  16. Ehab (2 comments)15 August 08

    Loosing emails is certainly crazy. Stick with Gmail, its gonna be a *long* time before db runs over 20mb. Hopefully within that time Gmail will increase their attachment limit ? :)

  17. Michael,
    Glad you did, thanks!

    Pink,
    Good good! Restoring is easy enough (Use the “Import” section on phpMyAdmin). And you can learn how to do that come the time, if you ever need to do it. Making the backups is the important part, so don’t worry about it. :)

    Ehab,
    I hope so! That would definitely solve things. :D

  18. Wow, thanks. This is exactly what I’ve been looking for. What a great post!

  19. This is AWESOME! I’ve been manually backing up about 20 WP sites every month. You just saved me about 2 hours ad infinitum. Thanks soooo much.

  20. Glad you found it useful screwzoo! :)

  21. I like it. WordPress plugin really makes life much easier huh?

    Now you’d better have a backup of your web server files on your local hard drive, or else… ;)

  22. Hendry,
    Very true! I used to be great at keeping that backup up to date, but with automatic plugin upgrades now, it never is. But I suppose if my only loss is that I need to reinstall a few plugins, i’ve gotten off lucky! :D

  23. Stephen (2 comments)15 December 08

    This is a good method but it’s something that it’s possible to do it too often, back ups are geart but if you do them too often you don’t gain any benefits.

    The idea of having daily backups is only good if a site changes every day, otherwise you’re robbing yourself of server capacity without needing it.

    If you’ve got a small, not very busy blog you’ll get away with considerably less regular backups and will leave that extra capacity for, say, resizing images and serving dynamic content.

    Saving a bit of CPU time is irrelevant on your home system but you still pay for it on rented hosting – the difference between too regular backups and just enough backups could be dozens of dollars a month extra in higher capacity hosting.

    • That’s true Stephen, but it would only really apply if you were right on the threshold of your hosting account’s limits. Backups are so crucial, I’m happy enough to make them daily to be honest. It might cost the server a little more, but you’ll be glad of it if your server ever does crash.

      • Stephen (2 comments)19 December 08

        Very true, although packaging up an entire database is a fairly processor consuming process, I think that if an application needs backups that are hourly (or even more often, in the case of extremely critical applications) then you’re negligent not to give it the resources to do that. It’s crucial enough to be an operating requirement of the application concerned – just like there needs to be enough processor time and memory to serve pages for the program to work.

        If you are hosting a blog which really doesn’t change content every day (say it’s an irregularly updated personal journal of your life and therefore doesn’t attract too many posts or too many comments) then there’s no need to update the backup everyday if the backups are going to be identical. If your blog changes even more often and you can’t risk losing any comment or post, then you could set it up backup even every hour. It’s just a question of the applications needs – backing up less than you need to is very bad practice but if you backup more than required you’re just using up cycles without getting value from them.

  24. Great WP plug in, amazing!

  25. nice plugin thank you so much..

  26. dmk (1 comments)31 December 08

    now that is an excellent example of lateral thinking. thank you. i’m off to set my google apps mail filters to receive, label and archive automatically weekly.

    sweet!

  27. That is a GREAT idea for backing up a blog, thanks so much!

  28. darnals (5 comments)29 July 09

    thanks brother its can make me easy to backup my database every 1 days.
    sometimes the hosting error or suspend, and all my data lost.

    maybe im wrong to take my blog to leecher hosting :d

    lets share anything to the world
    .-= darnals´s last blog ..LINEAGE II Server Files =-.

  29. Yep! This is the way to do it. This is usually one of my first steps after install except I use the WP-DB-Backup plugin by Austin Matzko.

  30. I use this and I love it. I set up a filter in Gmail to catch my DB’s and then label them. Its amazingly fantastic, and all done behind the scenes once a week.

  31. That’s really good advice. Works perfectly. Love it. The htaccess file was a text file (with .txt) at the end, so you need to rename it to ‘.htaccess’ after uploading to the backup-db folder, am I right?

  32. Avery (11 comments)31 August 09

    Sounds great,I never heard the Plugin before.Thank you for sharing.

  33. test (3 comments)2 September 09

    Excellent blog was very useful……

  34. wowww….thnks…

  35. This is a great way to do it. It’s amazing how many people run NO database backups and then freak out when something happens to their installation or database.

    Great tutorial!

  36. Backups are always a safe route to go…you never know when something very unlucky may happen!

  37. I’ve using this plugin since my site running. It works pretty good.
    I set automatic backup to every week cause I have thousands of page & more than 100mb mysql database and I don’t want to create high server load.
    If you’re running light blog I think it’s fine to set automatic backup to every day.

  38. My entire WP-Content folder was just deleted.. I’m going to find every backup plugin on the internet.. What a hassle.

  39. Thanks alot for this great plugin tip!

    What I’m wondering is if you can do an update to this post since it appears some of the items on the backup tools page/dashboard may have changed in the year plus?

    Specifically, what about all those extra checkmarks for tables under
    Backup > Tables > You May choose to include any of the following tables …..
    as well as
    Scheduled Backup > Tables to include in the scheduled backup: Click and hold down [SHIFT] to toggle multiple checkboxes

    do I include and check mark all those extra boxes or just the default settings ( nothing else being checkmarked)? I’d sure appreciate any direction on this issue — thanks and cheers!

  40. Greetings Michael –

    Great article. One tip I found to even further automate this process is to setup a filter in Gmail. In my filter, I tag it “Blog Backup” and auto archive it. This takes a step out of me having to clean up my inbox everyday.

    The more automation the better.

    - D3

  41. meong (1 comments)15 November 09

    nice and great brother

  42. Thank you.. for sharing articles.. Great!!

  43. Was looking for this for like 3hrs! Since i saw you repost this on Twitter I believe, if not someone else, but found it amazing & forgot to “favorite. Left me hunt down online. Google is kind tricky leading to other sites & what not, similar & sooo off topic/unrelated to my hunt, glad I hunted this down though. Gonna be trying this out later today & see how it goes!

    Was hoping you could respond back to @CoolSlipknotMasks though, just so I can see what your response would be, curious is all….

    Anyways, AMAZING POST old or not, looking forward to trying out for my 1st WordPress blog for my site, thanks! =]

    - MexiChriS

  44. Great Poster !!

  45. wow,

    much easier than thought earlier.

    thanks for sharing this with us.

  46. GREAT post!!
    Just set it up on my website, and it’s working amazingly well and now I’m stress free from backing up hustles!
    Thanks for sharing!!

  47. Rosario (10 comments)19 January 10

    If you’re running light blog I think it’s fine to set automatic backup to every day, Great Post

Leave a Comment

Your reply will be added to the comment above (Below any other replies to this comment) -

(We DoFollow)

Not sure how to get an image with your comment?