首页 > 代码库 > 备份BinLog并压缩 全备份
备份BinLog并压缩 全备份
Rem Backup Mysql BinlogRem Backup Yesterday and RARRem Backup every day 00:01 begin backup yesterday and now binlog@set curPath=%~dp0@set SourcePath="\\110\ProgramData\MySQL\MySQL_Server_5.6\data\mysql-bin.*"@set WinRARPath="C:\Program Files\WinRAR\Rar.exe"@set BackupPath="%curPath%data"@Rem Yestoday@echo wscript.echo dateadd("d",-1,date)>GetOldDate.vbs@for /f "tokens=1,2,3* delims=-/. " %%i in (‘cscript /nologo GetOldDate.vbs‘) do ( @set y=%%i @set m=%%j @set d=%%k)@if %m% LSS 10 set m=0%m%@if %d% LSS 10 set d=0%d%@set Yestoday=%m%-%d%-%y%@set YestodayFolder=%y%-%m%-%d%@del GetOldDate.vbs@echo %Yestoday%@rem make yestoday folder@mkdir %BackupPath%\%YestodayFolder%xcopy %SourcePath% %BackupPath%\%YestodayFolder% /s /c /h /y /d:%Yestoday%@rem -m 存储方式: 0存储、1最快、2快速、3标准、4较好、5最优%WinRARPath% a %BackupPath%\%YestodayFolder%.rar %BackupPath%\%YestodayFolder%@ping -n 10 127.0.0.1>nulrmdir /s /q %BackupPath%\%YestodayFolder%
Mysqldump全备份
@Rem 检测是32位还是64位@REM code from http://support.microsoft.com/kb/556009/en-us@SET Bits=32SET RegQry=HKLM\Hardware\Description\System\CentralProcessor\0(REG.exe QUERY %RegQry% | Find /i "x86")If %ERRORLEVEL% == 0 ( REM 32 Bit SET Bits=32)ELSE ( REM 64 Bit SET Bits=64) @REM 设定mysqldump文件@SET curPath=%~dp0@SET MysqlDump=%curPath%mysqldump_exe\mysqldump_%Bits%.exe@REM 当前日期@set CurrentDay=%date:~,4%%date:~5,2%%date:~8,2%@Rem 设定备份目标目录set Backup_Folder="%curPath%sql"@Rem 设置数据库服务器IP及数据库信息set Dump_IP="192.168.1.110"set User_Name="root"set Password="1234"set Database="test"%MysqlDump% -h %Dump_IP% -u%User_Name% -p%Password% %Database% --default-character-set=utf8 --single-transaction --compress --max_allowed_packet=10240000 --net_buffer_length=16384 >%Backup_Folder%\%CurrentDay%.sql
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。