Backup my applications MySQL databases and copy to DropBox or similar

August 8, 2019 104 views
Backups

Hi All,

I have an online mysql based application hosted in a droplet. I use a script to automatically backup my dB's to my DO server every 6 hours. Is there a better/safer way to do these backups and how can I copy my backups to my DropBox account, or similar?

Regards

Gary

2 Answers

Hi garywilliams,

It's generally not a great idea to store your backups the same place your files are. If there is data loss, you'll lose both the backups and the files. Backups should be stored remotely so in that regards, using Dropbox is a good solution.

Using Dropbox to backup your date

Download Dropbox to the server

64-bit: cd ~ && wget -O – “https://www.dropbox.com/download?plat=lnx.x86_64” | tar xzf –

Run the dropbox daemon

~/.dropbox-dist/dropboxd

Running it for the first time, running the daemon will say something like

This computer isn't linked to any Dropbox account...
Please visit https://www.dropbox.com/cli_link_nonce?nonce=6bc8fb27643bc6c1d91264afe135f2ba to link this device.

Visit the link from your browser and link your server with your dropbox account. Once you do, your Dropbox folder will be created in your home directory.

~/Dropbox

Now you have Dropbox configured on the server. To actually backup your databases to Dropbox, change your script to dump the .sql file in your ~/Dropbox folder. From there, your files will be automatically synced with your account.

You can set a cron job to do that for you as well.

That's it!

Kind regards,
Kalin D.

Hi Kalin,

Genius!!

My problem solved. I'm going to try it now.

Many Thanks

Gary

Have another answer? Share your knowledge.