查看
Mysqlbinlog解析工具 解析2 官方文档 示例
mysqlbinlog -vv --base64-output=decode-rows binlog.000001
- -vv参数为查看具体SQL语句及备注。
- --base64-output=decode-rows参数为解析Binlog日志文件。
没有使用--base64-output=decode-rows
参数,导致输出的结果为未解析的内容。
--hexdump #显示十六进制内容
登录到mysql查看binlog
只查看第一个binlog文件的内容
show binlog events;
查看指定binlog文件的内容
show binlog events in 'mysql-bin.000002';
查看当前正在写入的binlog文件
show master status\G
获取binlog文件列表
show binary logs;
show global variables like
"%_time"
;
set
global long_query_time=2;
flush刷新log日志,自此刻开始产生一个新编号的binlog日志文件
flush logs;
mysqlbinlog -vv --base64-output=decode-rows --start-position=4 --stop-position=821 binlog.000002|mysql -uroot -p123456 -h127.0.0.1;#-vv参数才会显示delete insert语句