Skip to content

Instantly share code, notes, and snippets.

@exeleon
Created March 10, 2017 16:54
Show Gist options
  • Save exeleon/c0020c4a07b8d87240bdaf91e7e6b582 to your computer and use it in GitHub Desktop.
Save exeleon/c0020c4a07b8d87240bdaf91e7e6b582 to your computer and use it in GitHub Desktop.
@echo off
set /p=Press ENTER to start the backup...
set dbName=DBNAME
set dbUser=DBUSER
set dbPassword=BDPASS
set backupDir="C:\backups"
set mysqldump="C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqldump.exe"
for /F "usebackq tokens=1,2,3 delims=-" %%I IN (`echo %date%`) do echo "%%I" "%%J" "%%K"
set date=%date:/=_%
%mysqldump% --host="localhost" --user=%dbUser% --password=%dbPassword% --single-transaction --add-drop-table --routines --databases %dbName% > %backupDir%\%dbName%_%date%.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment