Buckup mysql DB to BitBucket

      No Comments on Buckup mysql DB to BitBucket
mysql backup

Its recommended for every sysadmin to schedule frequent backups for the systems they administer.

This will enable you have a backup of your database incase you lose your main system.

 

Here is a short guide on how to achieve this

 

If you don’t have git installed do so by running the following command

Redhat/Centos

Debian/Ubuntu

Lets Initialise our backup directory as a git repository

Got to bitbucket and create a private repository

Add the remote repository

You may be asked for your ssh credentials/keyphrase

 

The next step is to write a short script to that will run the backups on a daily basis

create a file called backup-mysql-to-git.sh

Make the file executable

Add the following commands to the script

Replace <db-password> with your mysql password, <db-name> with the db-name of the database you with to backup.

Once the script is ready, create a cronjob to run the script everyday. The cronjob below triggers at 12AM everyday

That’s done.

The following two tabs change content below.

harun

Harun is a System Administrator with proficient knowledge in cloud technologies such as KVM, Cloudstack, Citrix Xen Server, Openstack and VMware Vsphere Suite, Ceph, NFS, ISCSI

Latest posts by harun (see all)

Leave a Reply

Your email address will not be published. Required fields are marked *