Categories
Linux MAC UNIX Wordpress

Backup your WordPress Website to Dropbox on a Mac

We learned how to Backup & Restore a MySQL database HERE.
We learned how to tar a directory HERE.

Now lets combine this knowledge and backup our WordPress Website directly to Dropbox.

IMPORTANT: Keep in mind that I am running my website on my MAC (not a Linux distro).

You will need the following information:

  • Web Server Name (hostname)
  • MySQL User Name
  • MySQL Password
  • MySQL Database Name
  • Root Website Directory
  • Dropbox Directory Location

I am going to backup (dump) my MySQL Database into my websites root directory. Then I will zip the whole website directory and place it into my Dropbox folder.

mysqldump -u <USERNAME> -p<PASSWORD> <DATABASENAME> > /<WEBSITEROOTDIRECTORY>/<WEBSITENAME>.sql ; tar cvzf /<DROPBOXDIRECTORY>/<WEBSITENAME>.tar.gz /<WEBSITEROOTDIRECTORY>

Example:

mysqldump -u tommy -psupersecret itsmetommy > /Library/WebServer/Documents/itsmetommy/itsmetommy.sql ; tar cvzf /Users/Tommy/Dropbox/Backup/itsmetommy/itsmetommy.tar.gz /Library/WebServer/Documents/itsmetommy