Webmin MySQL backup – How to setup with retention?

Table of Contents

I want to keep Webmin MySQL backup for each day and don’t want to replace it with next day’s backup. Can you please set up this on my server?

That was a recent customer request we received in our Server Management Services.

Unfortunately, in  Webmin panel, a backup retention option for retaining the database backup for each day is unavailable.

Today, we’ll see how our Webmin Experts set up custom script and enable Webmin MySQL backup with daily retention.



The need for Webmin Backup

Backup of files and folders come handy in live servers. Similarly, it’s important to have the backup of databases and related tables. In case of any website failures, broken databases, version upgrades, etc. these backups allow a quick restore option. That’s why, almost all reliable hosting providers invest in good backup solutions.

Again, taking backup is not enough. It really matters the time for which server retains the backup. In this way, some server owners schedule weekly backups and retain them for a period of one month. As a result, it give website owners a possibility to restore database table from a month old backup too.

Moreover, while setting up Webmin MySQL backup, the frequency of backup and backup retention period should be in sync.

In this case, customer wanted a daily MySQL backup of all databases on the Webmin server. Also, he wanted to retain the backup for a day. It should not be replaced with next day’s backup. This involved setting the backup from the Webmin panel and creating custom script for retention.

We’ll now see how our Support Engineers did it for the customer.

Backup options in Webmin

The first step was to enable the backup of MySQL databases from the Webmin panel. Fortunately, Webmin backup module provides many custom settings. Therefore, we had to configure the following settings for enabling backup.

We connect to the Webmin >> Servers >> MySQL Database Server >> Backup Databases

Backup to directory is the folder that stores the backups. We set it as /home/database-backup as we wanted the backups on the same server.

We didn’t want to create additional resource usage on the server due to compression. Therefore, we set the Compression format as None. Moreover, the databases were not that big too.

Then, we set up backup notification email address in the field “Send backup status email to“. This helps customer to get an idea on the status of the backup in his inbox.

Also, we choose the option for the field Scheduled backup enabled? as Yes, at times chosen below. And, set the Simple schedule as Daily (at midnight). Webmin backup module also allows to set it to a particular date and time as well.

And, the final backup configuration would appear as:

How we set up Custom script for backup

Now that we’ve set up the backup module in Webmin, it is time to make arrangements for backup retention.

As we already know, a backup retention option for retaining the database backup for each day is not currently available via the Webmin panel. That’s why, we need to use custom scripts for retention.

In this custom script, we read the back up files available at /home/database-backup first. Then, our Dedicated Engineers make the script create another database backup at 11 pm daily in the another folder /home/database-backup-custom/. These new backup folder should have a different name to avoid confusion.

Further, we add the backup script as a cron job in the server. Thus, the backup will be done automatically everyday.

The results of the crontab listing of user root will show up as:

Again, we check and confirm the availability of backup files at the custom folder using du command too.

[root@xxx]# du -sch /home/database-backup-custom/*
20M /home/database-backup-custom/2019-06-07_09-59-18
20M /home/database-backup-custom/2019-06-07_10-01-01
40M total

Again, we can set the custom database tables backup at a remote server, Google cloud, or other backup storage as per user requirements.

[Looking for custom Webmin backup options? Our Webmin experts can set it up for you.]


To be precise, setting up Webmin MySQL backup involves configuration from the panel as per the customer requirements. Again, backup retention need custom scripts as well. Today, we saw how our Dedicated Engineers enabled MySQL backups in Webmin server with daily retention.

Leave a Comment

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

Social Share


Cheapest Web Hosting

Fasters Web Hosting Promo
Scroll to Top

Launch your Website at RS599

Create a professional website yourself with our domain hosting combo. Get Extra benefits at this Year end Sale with 10% OFF and Enjoy Amazing Deels on Shared Hosting!

Starting at Only RS599/Year

Year End Sale


Use Code STARTBIZ at Checkout.

Create an earning opportunity with A Web Hosting Business

Become reseller and start reselling domains, web hosting, ssl certificates and More.

45% OFF

Starting at RS399/Month


Use coupon: at the checkout.