Windows下的Mysql自動備份script

set BACKUP_ROOT=D:\Backup

set RAR_ARCHIVE=%BACKUP_ROOT%\%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%.rar
set SQL_FILE=%BACKUP_ROOT%\Backup%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%.sql
mysqldump.exe –opt –all-databases -u資料庫帳號 -p資料庫密碼 > %SQL_FILE%
“C:\Program Files (x86)\WinRAR\Rar.exe” a %RAR_ARCHIVE% %SQL_FILE%
DEL %SQL_FILE% /f /q

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>