日期:2014-05-16  浏览次数:20770 次

mysql mysqlbinlog 使用
mysqlbinlog -R -h 192.168.56.221 -u tongchao -p111111 mysql0-bin.000001 --start-datetime="2010-12-22 00:00:00" --stop-datetime="2010-12-22 05:00:00"
远程binlog获取
需要权限:replication slave权限

 
mysqlbinlog -d 591up /data0/mysql/3306/tc/log-bin.000536 --start-datetime='2010-12-20 00:02:50' | grep ol_question >/data0/mysql/ol_question2.txt

mysqlbinlog -d 591up /data0/mysql/3306/tc/log-bin.000536 --start-datetime='2010-12-20 00:02:50' | grep ol_question >/data0/mysql/ol_question2.txt

mysqlbinlog -d servant_591up "D:/3.7/logbin/log-bin.000456" --start-datetime="2011-03-04 21:00:00"  --stop-datetime="2011-03-04 22:10:00" >d:/sql/2011race/binlog.sql

mysqlbinlog -d servant_591up D:\sql\0415race\log-bin.000545 >> D:\sql\0415race\servant_591up.sql

mysqlbinlog -d servant_591up D:\sql\0415race\log-bin.000546 >> D:\sql\0415race\servant_591up.sql

mysqlbinlog -d servant_591up D:\sql\0415race\log-bin.000547 >> D:\sql\0415race\servant_591up.sql

mysqlbinlog -d servant_591up D:\sql\0415race\log-bin.000548 >> D:\sql\0415race\servant_591up.sql

//分析binlog
mysqlsla.pl -lt binary "D:\sql\0415race\servant_591up.sql" > D:\sql\0415race\mysqlsla.txt --top 100

// 使用mysqlsla 分析满查询
mysqlsla.pl --log-type slow "D:/861028/slow_query.log" >d:/sql/slow.txt

满查询
mysqlsla.pl -lt slow "D:/_861028/slow_query.log" -R print-unique -mf "db=591up" -sf "+SELECT"