Topic: Script to backup SQL Database and compress it

Hello All MVD community,

I need your help with a script to backup a SQL database and compress it into a RAR or ZIP format to be send out
by e-mail.  The process should take a SQL database saved  from MySQL Manager and compress it to be sent out
to specific e-mail addresses.  Don't know where to start sad


Thanks in advance!

2 (edited by adiziktdy 2019-12-17 05:15:30)

Re: Script to backup SQL Database and compress it

Hi, gonpublic2k

I started with writing dump.bat

rem date DDMMYY
set name1=%DATE:~0,2%%DATE:~3,2%%DATE:~8,2%

rem time ( 10:00 and after)
IF "%time:~0,1%" LSS "1" (
   set name2="0"%TIME:~1,1%%TIME:~3,2%
) ELSE (
   set name2=%TIME:~0,2%%TIME:~3,2%
)

mysqldump.exe --host=192.*.*.* --port=3306 -uUSER -pPASSWORD plan >d:\MySql_Plan\Arc\plan%name1%_%name2%.sql

"c:\Program Files\Total Commander\Plugins\arc\Rar.exe" m -ep d:\MySql_Plan\Arc\plan%name1%_%name2%.zip d:\MySql_Plan\Arc\plan%name1%_%name2%.sql

Try it

Yana

Re: Script to backup SQL Database and compress it

adiziktdy wrote:

Hi, gonpublic2k

I started with writing dump.bat

rem date DDMMYY
set name1=%DATE:~0,2%%DATE:~3,2%%DATE:~8,2%

rem time ( 10:00 and after)
IF "%time:~0,1%" LSS "1" (
   set name2="0"%TIME:~1,1%%TIME:~3,2%
) ELSE (
   set name2=%TIME:~0,2%%TIME:~3,2%
)

mysqldump.exe --host=192.*.*.* --port=3306 -uUSER -pPASSWORD plan >d:\MySql_Plan\Arc\plan%name1%_%name2%.sql

"c:\Program Files\Total Commander\Plugins\arc\Rar.exe" m -ep d:\MySql_Plan\Arc\plan%name1%_%name2%.zip d:\MySql_Plan\Arc\plan%name1%_%name2%.sql

Try it

Hi, thanks for sharing.  I'm not sure if it's something with the long name path that you shortened with the " ~ " character but this does not
work.  I'm trying to see if I can write a batch that will do the dump for now and use that within MVD to call it as an external program.

Re: Script to backup SQL Database and compress it

** UPDATE ** 

Hi all,

Well, after doing a little bit of research on the forum , I found this thread where the first part of the MySQL backup is
done.  Good job @prahousefamily  !! 

http://myvisualdatabase.com/forum/viewt … 261#p21261

Now I just need to use the backup.bat archive that's created save and compress the MySQL database and mail it to specific e-mail addresses in MVD via a script.  I need to be able to create an automated e-mailer that con grab the archive (##name##year-month-day.sql) and deliver it
to the addresses specified in the program.  I need help with that part.

Thanks!