How To,Wordpress Tips  

How to create a full WordPress backup and restore or sync it with local website

I backup my wordpress once a month. I recommend  you backup your wordpress  too. You won’t regret  having backup, instead  you will be happy when thing go wrong. There will be always a option to go back. for most having a backup and restore is scary task. but if you do it several time it become habit. I want to explain how you even can make it fun and enjoy having full WordPress backup!

Most important part of your wordpress to have a backup of them is wordpress database and wp-content folder.

you need to make sure you included above in your backup. other section are not much important becase you can always download wordpress core files from wordpress website. or regenerate wp-config and .htaccess  file.

However to mike life easy is best, we create one backup and include all files on server.

Doing full backup of live website

Making backup of database:

Make a database backup using wp-dbmanager wordpress plugin <– good for beginners

other good alternative are WP-phpMyAdmin <–  Good for professionals!

Making  backup of files:

Copy your wordpress files  by using a ftp program such as free ftp filezilla

Restoring from full backup to online website

Restore database from a backup

by using phpmyadmin you can transfer your backup database to online database.

do not worry. there is nothing to lost. because you already have a backup. you may need remove database if you did not checked “ADD DROP TABLE / VIEW / PROCEDURE / FUNCTION” when you did database export.

Restore files from backup to server

This section is easy. again by using ftp program you can copy back or upload all files to your server.


Note:  You can restore your backup to another website too. This way your second website become exact clone of first website. To clone your WordPress to another Domain you need to

  • change wp-config file with new database name, user and password.
  • Change value of siteurl and home  of wp-option table in database to  new website URL ( using php my admin in new website. or using a text editor and replace the value inside sql file before restoring the database.

You can use above solution to make backup and restore of any wordpress website.

How sync my online wordpress with local  wordpress?

As coder the way I do is like this. I sync my online database to my local database. I zip my my online files and after transfer to local storage I extract them in local domain. zipped files are much smaller and copying one file from in much faster and safer  than copy all server files one by one.

To make life easier my local domain and database are same as online domain and database. so I no need change wp-config or database site and home value. So my online website will be 100% exact clone.

Working on exact clone at localhost is very fast and fun. It’s like you have tomorrow internet speed. I sync from server to local one time at end of the month. during month I work at local wordpress. If I were happy with result I transfer them to online wordpress site.

You may want to read my previous post on Simple way to backup your online wordpress website and clone or sync it to local development website by using SSH

Do you have better or easier solution? Please share it with rest of the world in comments.
I hope you enjoyed. If  still you need my assistante , I’ll be happy to help you.

Do you need farther help on this topic? Contact me
Do you need Professional coder? Hire me
Looking for different WordPress plugin? Try Wishlist member


Andy is one of core WordPress WishList Member Developer. He is in love with WordPress and fun of turning new ideas to WordPress plugin or theme.

Add your comment


  1. ilayka
    May 3, 2010
    6:09 am

    Easy to understand, I am going to upload my blog from localhost to the Internet.


  2. Paul Coughlin
    May 22, 2010
    5:13 am

    That’s useful. There’s an even easier little trick, if you don’t mind editing your hosts file – then there’s no need to change the wp-config or database blog address values.

    Edit your hosts file to create an entry for your blog url, but use your local ip address.

    Then your offline local install won’t need any settings changed.

    The only problem, is knowing which site you are working on! – so i always edit my blog title on my local version – add *** to the beginning of the blogname.

    At the end of the month, remove the hosts entry and upload to the live site..

    all the best,
    Paul.


  3. Andy
    May 27, 2010
    1:00 pm

    Thanks Paul for your time and feedback,
    I do agree with you. I also do not like change the wpconfig. Your idea about changing title of cloned website is great. I code inside my VM machine and no need change host entry every month to switch between live website and cloned one. I only change the dns entry in VM once. I always can see cloned website in VM machine and same time, I can see the real website at my host computer. I can always switch between real website or cloned website by using foxy proxy and firefox!

    Have a great day
    Andy


  4. Luis
    July 7, 2010
    1:05 pm

    how you thought about doing it automatically?


  5. Fred
    July 20, 2010
    8:49 am

    I did a search and found your site about how to make local worpress same as server.

    You said “To make life easier my local domain and database are same as online domain and database. so I no need change wp-config or database site and home value. So my online website will be 100% exact clone.”

    How do I set up my local domain and database to be the same as the online domain and database?


  6. Andy
    July 20, 2010
    9:05 am

    Hello Fred,

    Make your IP static. let say change it to 192.168.1.5

    Then add your site domain name to the windows or linux host file

    you can find host file at windows xp under folder C:\WINDOWS\system32\drivers\etc\host

    or at Linux it is under /etc/hosts

    You need add

    192.168.0.5 yourwebsite.com
    192.68.0.5 http://www.yoursite.com

    to above files ( you OS host file)

    This way yoursite.com point to your website at your localhost and you have no longer access to yoursite.com on the internet! ( unless you change the host file)

    To avoid changing host file everytime in order to decide to access to the same website on the internet or localhost, I use VM and I setup my local host website inside VM machine.

    About having same database task is more easy. Simply export whole database ( and Not selecting all tables inside the database to export.) when you export whole database it keep database structure and by importing it to local, the database will be 100% clone.


  7. Fred
    July 20, 2010
    12:40 pm

    I tried to make the change in notepad. When I closed to save it a window opened saying “Cannot create the c:\Windows\System32\drivers\etc\hosts file.

    Make sure that the path and file name are correct.”

    I changed permission so that it was not read only, but still didn’t work. Any ideas on how to address it?


  8. Fred
    July 20, 2010
    7:23 pm

    I solved the problem. I had to copy the hosts file to another folder, change it and then copy it back to the etc folder. Now, when I open local, it does go to same URL locally. I don’t do VM. So, I assume that if I edit locally, I will need to upload files changed, or all files and the database to the server. And same in reverse, if I edit on-line. Correct? Thanks for your help.


  9. Marcus Wickes
    October 12, 2010
    11:23 am

    I used to do a manual backup but I found that once I was maintaining over 20 websites I just threw in the towel and gave up on backups, except the critical sites I couldn’t afford to lose. But even then I wasn’t backing up nearly as often as I should.

    Then I really started using S3 for media hosting and I decided to find a wordpress plugin that would backup to S3. I love the new plugin I have been using for the last couple months.

    Automatic WordPress Backup
    http://www.webdesigncompany.net/automatic-wordpress-backup/

    I set it and forget it. It’s easy to configure, easy to restore backups, and I no longer worry if I have a backup or not. Whew… so long manual backups!

    P.S. I do not work for that plugin company… I simply love this plugin over several other S3 plugins I tried and I came across your blog today.


  10. Andy
    October 28, 2010
    7:47 am

    Hey Marcus,
    Thanks for comment. Automated Backup to external storage is very convenience. But as soon as your website database become big, then script can not handle that and it give time out. I am agree, manual backup is little harder but it always works!


  11. Lisa
    February 1, 2011
    6:44 am

    Thanks Andy…

    Will look at this in more detail as I set up my local WordPress. I’m having a bit of trouble importing my existing MySQL db, but will follow your steps.

    I do have a question. I have heard that there are some plug-ins whose options are not saved unless some additional files are saved. Can you comment on this?

    Thanks so much!


  12. Andy
    April 9, 2011
    9:31 am

    Hello Lisa,

    It is possible for a plugin to save its option inside a file rather than database. It should be rare and I am not aware of such plugin.

    Thanks
    Andy

RSS feed for comments on this post. TrackBack URL

Add your comment.





( DoFollow )

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Home | Themes | Plugins | Download | Forum | Freelance | Resume | Projects | Service | Contact | About
© Copyright 2009 - 2012 Hecode.com