MySQL Backup Script in Perl for Windows

This backup script requires Perl to be installed. Any recent Strawberry Perl version will work fine.

It is capable of creating MySQL backups, compressing the backups, deleting old backups and sending an email when encountering an error.

Edit it to supply your MySQL credentials and adjust the parameters to your requirements.

Schedule it to run with Task Scheduler. I recommend a daily full backup.

In your Scheduled Task, the Action textbox should contain the full path to the perl.exe e.g. c:\Strawberry\perl\bin\perl.exe. The Add Arguments textbox should contain the full path to the script then a space then the word FULL or INC. e.g. C:\Scripts\mysql_backup\mysql_backup.pl FULL

A FULL backup will produce a zip file containing a MySQL Dump SQL file. An INC backup (short for incremental) will simply flush the binary logs which means that all transactions still in memory will be written to a binary log file and then a new binary log file will become the current one. You should backup those binary log files , normally found in the MySQL Data directory, as part of your backup procedures in case you want to restore to a particular point in time in the future. Typically incremental backup jobs are run every hour in order to produce up to 23 incremental backups (binary log files) per day which is manageable and not a headache to restore if you ever needed to restore them.

MySQL Backup Script in Perl for Windows

Posted

in

,

by

Comments

Leave a Reply

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