There are actually many methods to back up mysql, but not all mysql can run in linux. Backup in windows is also indispensable. The following section will teach you how to back up mysql using the bat script. Let's take a look at how to back up mysql using the bat script!
Rem
Rem C: The Program FilesWinRAR must be placed under the path to call the rar cli tool.
Rem
Redirect rem to the working directory
F:
Cd f: DBBAK
Rem setting variable: Backup File Name
SET BAK_FILE = MY_DBBAK _ % date :~ 0,-4%. SQL
Rem setting variable: Log File Name
SET LOG_FILE = MY_DBBAK.log
Rem record log
Echo "% date %" % LOG_FILE %
Rem starts backup
Mysqldump -- default-character-set = utf8-hlocalhost-uroot-R -- triggers -- single-transaction-B mydb> % BAK_FILE %
Rem compressed backup file
Rar a packet bak_file).rar % BAK_FILE %
Rem Delete source file
Del/F % BAK_FILE %
Echo "% date %" % LOG_FILE %
Echo "" "% LOG_FILE %
After the script is deployed, add the "scheduled task" project to the system.