MySQL incremental backup and full backup batch under Windows

Source: Internet
Author: User
Tags flush ftp mkdir rar

Full-standby batch processing under win

Batch processing is used for game servers, rigorously tested and formally used, and is used primarily to fully back up the database, of course. It's just a few backups.

, the function of FTP can be invoked on a remote server that remotely transmits the backed-up data, which is not described in detail and does not understand

Can be message, can also mail to jzcxfy@opkeep.com

The code is as follows Copy Code
@echo off
@echo ###################################################################
@echo # RAR backup script to backups.
@echo # BACKUP for Mysql City to City (WINDOWS)
@echo # jzcxfy@opkeep.com
@echo ###################################################################

Set Path=c:\ "program Files" \winrar;%path%
Set Mysqlpath=c:\ "program Files" \mysql\ "MySQL Server 5.0"
Set Bakpath=e:\mysql_bak
Set Username=root
Set password=1234567890



REM Please be careful to choose the backup mode, shielding other unwanted (front plus REM)
REM Backup using Mysqldump method

  code is as follows copy code

mkdir%bakpath%\data

%mysqlpath%\bin\mysqldump-u%username%-p%password%--single-transaction--default-

Character-set=utf8--flush-logs--master-data=2--delete-master-logs spirit_beast >%

Bakpath%\data\spirit_beast%date:~0,10%.sql


%mysqlpath%\bin\mysqldump-u%username%-p%password%--single-transaction--default-

Character-set=utf8--flush-logs--master-data=2--delete-master-logs quartz_event >%

Bakpath%\data\quartz_event%date:~0,10%.sql


RAR A-ag%bakpath%\full\%bakpath%\data\*.sql

RMDIR/S/q%bakpath%\data\

@echo%date%%time% full bakup finish >> C:/mysqlbakup.log

Incremental backup batch under win

This batch is used for game servers, rigorously tested and formally used, and is used primarily for full incremental backup of the database, of course. If you want to use this

Features also need to open the MySQL data binlog function, or you will not be able to make incremental backups, which is inevitable, this is just a few backup

Out, as for how to remote transfer of data backed up remote server can invoke the function of FTP, this script does not specify, not

Understand the message, but also mail to jzcxfy@opkeep.com

The code is as follows Copy Code
@echo off
@echo ###################################################################
@echo # RAR backup script to backups.
@echo # BACKUP for Mysql City to City (WINDOWS)
@echo # jzcxfy@opkeep.com
@echo ###################################################################

Set Path=c:\ "program Files" \winrar;%path%
Set Mysqlpath=c:\ "program Files" \mysql\ "MySQL Server 5.0"
Set Bakpath=e:\mysql_bak
Set Username=root
Set password=1234567890

REM Please be careful to choose the backup mode, shielding other unwanted (front plus REM)
REM Backup using Mysqldump method
mkdir%bakpath%\data
%mysqlpath%\bin\mysqladmin-u%username%-p%password% Flush-logs
xcopy/e/c/h/y%mysqlpath%\data\mysql-bin.*%bakpath%\data
RAR A-ag%bakpath%\diff\%bakpath%\data\mysql-bin.*
RMDIR/S/q%bakpath%\data\

@echo%date%%time% dincremental bakup finish >> C:/mysqlbakup.log

After doing this, we can simply add a scheduled task to Windows to achieve a scheduled backup.

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.