MySQL Forums
Forum List  »  Newbie

Re: Eventscheduler and mysqldump backup
Posted by: Barry Galbraith
Date: May 03, 2017 09:52PM

I created a batch file to run mysqldump, and run the batch file with event scheduler.

The batch file generates a filename based on the date and time, then backs up the list of databases to that file.

@echo off
for /f "tokens=1,2" %%u in ('date /t') do set d=%%v
for /f "tokens=1" %%u in ('time /t') do set t=%%u
if "%t:~1,1%"==":" set t=0%t%

set datestr=%d:~6,4%%d:~3,2%%d:~0,2%
set timestr=%t:~0,2%%t:~3,2%

mysqldump -uroot -ppassword --master-data=2 -E -R --triggers --flush-logs --result-file="D:/backup_folder/backup_file %datestr% %timestr%.sql" --databases databases to backup

Check the refman for mysqldump options you require.

Good luck,
Barry.

Options: ReplyQuote


Subject
Written By
Posted
Re: Eventscheduler and mysqldump backup
May 03, 2017 09:52PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.