《MYSQL LOGBIN 数据日志恢复数据库随笔》要点:
本文介绍了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
转载请注明本页网址:
http://www.vephp.com/jiaocheng/5548.html