Skip to content

Instantly share code, notes, and snippets.

@stevebauman
Created July 5, 2017 21:30
Show Gist options
  • Save stevebauman/5d1387042b467712307e03c0cd934049 to your computer and use it in GitHub Desktop.
Save stevebauman/5d1387042b467712307e03c0cd934049 to your computer and use it in GitHub Desktop.
MySQL Windows Server Backup Script
echo Starting Backup.
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set dt=%%c-%%a-%%b)
For /f "tokens=1-4 delims=:." %%a in ('echo %time%') do (set tm=%%a%%b%%c%%d)
set database=database
set username=root
set password=password
set file=%database%-%dt%-%tm%.sql
echo Backing up to file: %file%
mysqldump --routines -u %username% -p%password% %database% > E:\Backups\%file%
echo Backup Complete!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment