Home >Database >Mysql Tutorial >Mysql automatic backup
Batch processing command:
set"Ymd=%date:~,4%%date:~5,2%%date:~8,2%"
set"hMs=%time:~,2%%time :~3,2%%time:~6,2%"
mysqldump-uroot --password=password weixin> D:mysql_backweixin_%Ymd%_%hMs%.sql
Command explanation
To use mysqldump, you need to set it up The environment variable
Mysqldump.exe program is in the bin directory of the mysql installation directory.
Set is a command to set variables in batches.
%date:~, 4% is a string of length 4 starting from position 0 of the date variable.
% date:~5,2% is a string of length 4 starting from position 5 of the date variable
weixin is the name of the database
> followed by the output directory
Windows task plan implements batch processing every once in a while
Run (Win+R) Enter taskschd.msc to open the task scheduler
Click on the task scheduler library
There is a Create Basic Task on the right side
Step by step
Finally enter the batch process Just follow the path
You can manage the task plan in the task scheduler