MySQL Database Backup

July 2017

When managing websites for clients, very often these sites would make use of a MySQL or MariaDB database. As part of the maintenance of sites I try to ensure that such databases are backed up as regularly as possible. There are an enormous number of available options to automate this process, however most of these are bloated or a third-party solutions which have features which are not necessary for most installations. I wanted a solution which was lightweight and required the minimal amount of installation and maintenance.

 

I wrote a small and simple BASH script which made use of the mysqldump utility which is preinstalled on the majority of MySQL and MariaDB installations. This meant that there was no need to install any third-party packages or software. The script could then be set up as a cronjob to automatically backup the chosen database at set intervals to meet the requirements of backup availability. The script also automatically removed any backups which were older than a certain time-period. The script also gave you control over the end backup location so you could send them to any directory, such as to a remote server, to provide further redundancy.

MySQL Database Backup

Do you want to work with me on a similar project?

If you have a project requirement for your own website or web application I would love to work with you. Get in touch via the contact page or send an email to contact@alexwinder.com with your request.