You can write a PowerShell script and have Windows Task Scheduler run it every 2 hours
A quick and dirty example script:
# Declare variables $db = "[DB NAME]" $user = "[DB USERNAME]" $pw = "[DB PASSWORD]" $date = (Get-Date).ToString("yyyy-MM-dd_HH.mm.ss") $mysql_backupfile = ".\backup_$date.sql" $zipped_backupfile = "$mysql_backupfile.zip" # Backup MySql database mysqldump --user=$user --password=$pw --databases $db > $mysql_backupfile # Compress file using 7zip sz a -tzip $zipped_backupfile $mysql_backupfile # Remove uncompressed backup file rm -Path $mysql_backupfile
Change the database name, username and password and date format to whatever you need.
Note: I'm not entirely sure of the security implications of inserting the username and password directly into the script but if your server is secure I'm sure it'll be fine. But you can load the credentials however you like (e.g. from an environment variable)
Edit for question in comment:
To delete '.zip' files older than 3 days:
Get-ChildItem -Filter '*.zip' | where { $_.LastWriteTime -lt (Get-Date).AddDays(-3) } | Remove-Item