PHP群:95885625 Hbuilder+MUI群:81989597 站长QQ:634381967
    您现在的位置: 首页 > 数据库 > MySQL教程 > 正文

    MYSQL LOGBIN 数据日志恢复数据库随笔

    作者:admin来源:网络浏览:时间:2017-07-19 21:03:26我要评论
    分享到
    导读:MYSQL LOGBIN 数据日志恢复数据库随笔
    ======================================================

    BINLOG导出SQL文件
    ======================================================

    C:\Program Files\MySQL\MySQL Server 5.7\bin>mysqlbinlog binlogpath > sqlfilepath  -d dbname -f --stop-datetime stopdatetime  --start-datetime startdatetime

    -------------参数解释----------------

    binlogpath BINLOG完整路径(D:\data_backup\mysql_binlog\bin-log.000013)

    sqlfilepath 导出到SQL文件的完整路径:(d:\a.13.11.sql)

    stopdatetime BINLOG导出筛选结束时间:(2017/07/17T13:33:26)

    startdatetime BINLOG导出筛选开始时间:(2017/07/17T09:43:02)

    dbname BINLOG导出筛选数据名称

     


    ======================================================

    命令行执行SQL文件
    ======================================================

    mysql -f -uroot -ppwd -Ddbname<file

    ---------- 参数解释-------------

    -f 忽略错误,继续执行

    -u 数据库username

    -p 数据pwd 特殊字符转义符^ 

    -D 执行文件的目标数据库

    file 执行的sql文件完整路径

     
    ======================================================

    另新启一个BINLOG文件 MYSQL COMMAND 下执行
    ======================================================

    flush logs;

     

     

     

    ======================================================

    BAT 为MYSQL执行多个文件,并记录完成时间日志,有待优化为 FOR

    ======================================================

    @echo off 
    mysql -uroot -ppwd -Ddbname<D:\cc\bin-log.000010.sql
    set d=%date:~0,10%
    set t=%time:~0,8%
    echo %d%%t% bin-log.000010.sql execed >> d:\cc\result.txt

    mysql -uroot -p1q2w3e4r5t^^Y^&U*I(O)P -Dleizuwenhuadb<D:\cc\bin-log.000011.sql
    set d1=%date:~0,10%
    set t1=%time:~0,8%
    echo %d1%%t1% bin-log.000011.sql execed >> d:\cc\result.txt

    mysql -uroot -p1q2w3e4r5t^^Y^&U*I(O)P -Dleizuwenhuadb<D:\cc\bin-log.000012.sql
    set d2=%date:~0,10%
    set t2=%time:~0,8%
    echo %d2%%t2% bin-log.000012.sql execed >> d:\cc\result.txt

    mysql -uroot -p1q2w3e4r5t^^Y^&U*I(O)P -Dleizuwenhuadb<D:\cc\bin-log.000013.sql
    set d3=%date:~0,10%
    set t3=%time:~0,8%

    echo %d3%%t3% bin-log.000013.sql execed >> d:\cc\result.txt
    echo %d3%%t3% all exec complate >> d:\cc\result.txt

    pause

    转载请注明(B5教程网)原文链接:http://www.bcty365.com/content-35-5882-1.html
    相关热词搜索:
    网友评论: