FAQ Series | How to regularly back up MySQL with bat script under Windows

Source: Internet
Author: User

Not all MySQL run under Linux, Windows also need to do a routine backup, the following is a bat script to do automated backup example, you can refer to.

Rem
REM C:\Program Files\winrar need to be placed under path in order to invoke the RAR CLI tool
Rem
REM Jump to working directory
F:
CD F:\DBBAK
REM Set Variable: backup file name
SET Bak_file=my_dbbak_%date:~0,-4%.sql
REM Set Variable: Log file name
SET Log_file=my_dbbak.log
REM Recording Log
echo "%date%" >>%log_file%
REM Start doing backup
Mysqldump--default-character-set=utf8-hlocalhost-uroot-r--triggers--single-transaction-b mydb >%BAK_FILE%
REM Compress backup files
RAR a%bak_file%.rar%bak_file%
REM Delete source files
del/f%bak_file%
echo "%date%" >>%log_file%
echo "" >>%log_file%

After the script is deployed, all that is left is to add a "Scheduled Tasks" item to the system.



--------------------------------------Split Line--------------------------------------

Hall of Understanding ( http://zhishuedu.com Training is a professional quality training brand jointly launched by senior MySQL expert Ye Jinlong and Wu Bingxi, which mainly includes MySQL DBA combat optimization and Python Operation Development Course, which is the most conscientious and quality training course in the industry.

This article is from the "Lao Ye teahouse" blog, please be sure to keep this source http://imysql.blog.51cto.com/1540006/1879727

FAQ Series | How to back up MySQL regularly with bat script under Windows

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.