• windwos异地备份Mysql数据库


    @echo off
    @title Mysqlbackup

    echo MySQL数据库备份
    echo ***********************
    echo Today %date%
    echo Time %time%
    echo ***********************

    rem 设置文件路径
    set files=D:ackup

    rem 当前日期(格式YYYYMMDD)
    set bak_date=%date:~0,4%%date:~5,2%%date:~8,2%

    rem 临时文件夹
    set bak_tmpFile=C:~UpTemp

    rem 日志文件夹
    set bak_logPath=C:~bak_log

    md %bak_tmpFile%
    md %bak_logPath%

    echo -------- 开始压缩 [%bak_timeStart%] >%bak_logPath%log-%bak_date%.txt

    rem ftp信息
    set bak_ftpServer=42.51.152.166
    set bak_ftpUserName=anymous
    set bak_ftpUserPass=anymous
    set bak_timeStart=%time%

    @echo 开始backup Mysql
    md "D:ackup\%Ymd%mysql"
    "D:phpStudyMySQLinmysqldump.exe" --opt -Q -uroot -p123456 --default-character-set=utf8 discuz > "D:ackup\%Ymd%mysqldiscuz.sql"
    "D:phpStudyMySQLinmysqldump.exe" --opt -Q -uroot -p123456 --default-character-set=utf8 dede > "D:ackup\%Ymd%mysqldede.sql"
    "D:phpStudyMySQLinmysqldump.exe" --opt -Q -u root -p123456 --default-character-set=utf8 weixin > "D:ackup\%Ymd%mysqlweixin.sql"

    @echo 开始压缩文件
    C:
    cd C:Program FilesWINRAR
    RAR.EXE a -r -y %files%%date%.rar %files%*
    rem 生成ftp命令文件
    echo open %bak_ftpServer% >ftp.up
    echo %bak_ftpUserName%>>ftp.up
    echo %bak_ftpUserPass%>>ftp.up
    echo bin >>ftp.up
    echo mput %files%* >>ftp.up
    echo bye >>ftp.up
    FTP -s:ftp.up -i >>%bak_logPath%log-%bak_date%.txt
    del ftp.up /q
    rem Xcopy %bak_tmpFile%* C:Temp /y
    del %bak_tmpFile%*.* /q /s
    rd %bak_tmpFile% /q
    echo "Backup OK~ Please Cat FTP"
    pause

  • 相关阅读:
    springboot ssm propertis 如何搭建多数据源动态切换
    发送验证码
    二维码生成
    文件上传 下载
    git拉代码报错
    通过url 下载文件
    原生JS实现挡板小球游戏
    深入浅出解析AJAX
    深入解析CSS3圆周运动
    JS递归原理
  • 原文地址:https://www.cnblogs.com/yangxiaofei/p/5032728.html
Copyright © 2020-2023  润新知