Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use bat script to back up mysql regularly under Windows

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to use bat script to back up mysql regularly under Windows". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "how to use bat scripts to back up mysql regularly under Windows"!

Not all MySQL runs under Linux, and windows also needs to do routine backups. The following is an example of using bat scripts to do automatic backups, which you can refer to.

Rem

Rem C:Program FilesWinRAR needs to be placed under path before you can call the rar cli tool

Rem

Rem jumps 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 logging

Echo 'date%' 'LOG_FILE%

Rem starts making backups.

Mysqldump-- default-character-set=utf8-hlocalhost-uroot-R-triggers-- single-transaction-B mydb >% BAK_FILE%

Rem compressed backup files

Rar a BAK_FILE%.rar BAK_FILE%

Rem deletes the source file

Del / F% BAK_FILE%

Echo 'date%' 'LOG_FILE%

Echo "" LOG_FILE% "

After deploying the script, all that is left is to add a "scheduled task" project to the system.

At this point, I believe you have a deeper understanding of "how to use bat scripts to back up mysql regularly under Windows". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report