Backing up MySQL using DPM….rubbish you say? not quite 🙂

Microsoft DPM allows for pre and post backup scripts to be run which means you can write a script
which backs up mysql, dumps the backup to disk and then DPM will backup this file.

Step 1 – Create MySQL backup script
Here’s an example script which could work for you

@echo off
set currentdate=%date:~-4,4%%date:~-7,2%%date:~-10,2%
move /y c:\mysqlbackup\publicsite-*.sql c:\mysqlbackup\publicsiteold.sql
mysqldump –user backupuser –password=yourpassword databasenane > c:\mysqlbackup\publicsite-%currentdate%-full.sql

Replace the database name and username and passwords to match your environment. The idea of
this script is to backup the database with the current date in the file name and make a
backup of the previous version to an OLD file.

Step 2 – Create DPM Protection Group to backup the MySQL Backup
Here, all we need to do is create a protection group to match the settings you would like,
just make sure you are backing up the directory where the MySQL backup files are stored,
something like C:\MySQLBackup

Step 3 – Modify ScriptingConfig.xml on the DPM Agent server
C:\Program Files\Microsoft Data Protection Manager\DPM\Scripting\ScriptingConfig.xml
This is the file which is used to configure pre and post backup scripts.
Below is a copy of the file I used but you can modify for your environment. The important thing to make note of is the “DataSourceName” which needs to match the datasource which you are backing up. If the directory are you backing up is on C: or D: make sure this is reflected in this value.
<?xml version=”1.0″ encoding=”utf-8″?>
<ScriptConfiguration xmlns:xsi=”;
<DatasourceScriptConfig DataSourceName=”C:”>
If the pre backup script fails, so will the DPM job. This is fantastic because now all we have to do is monitor DPM job status huzzah!

Cheers Luke