@echo Off &setlocal enableextensions::----------Configuration Items----------:: Backup placement path, plus \ Set Backup_path=E:\Backup:: The name of the database to be backed up, with multiple spaces separating set DATABASES=Test:: MySQL user Name set USERNAME=root:: MySQL password Set PASSWORD=CentOS:: MySQL bin directory, plus \:: If you can use mysqldump directly (add MySQL bin directory to environment variable when installing), leave this blank to set MySQL="C:\Program files\mysql\mysql Server 5.7\bin\mysqldump.exe":: ----------do not modify the following----------Set Year=%Date:~0,4%Set MONTH=%Date:~5,2%Set Day=%Date:~8,2%:: If you enter under DOS TimeReturned is not -Hour System (No0fill), please modify the set HOUR yourself here=% Time:~0,2%Set MINUTE=% Time:~3,2%Set SECOND=% Time:~6,2%Set DIR=%backup_path%%year%\%month%\%day%Set ADDON=%year%%month%%day%%hour%%minute%%second%Echo%dir%Echo%addon%:: Createdir ifNot exist%dir% ( mkdir%dir%2>nul)ifNot exist%dir% ( EchoBackup path:%dir% NOT exists, createdirfailed. Goto exit) CD/d%dir%%mysql%-u%username%-p%password%%databases%>%databases%.%addon%.sql2>nulEchoExport complete
Backup MySQL database under windowns