查看全部二进制日志文件的列表mysql
mysql> SHOW BINARY LOGS;
肯定当前二进制日志文件的名称sql
mysql> SHOW MASTER STATUS;
查看二进制日志内容shell
shell> mysqlbinlog binlog_files | more # 或者将输出保存在文件中,而后在文本编辑器中查看文件 shell> mysqlbinlog binlog_files > tmpfile
执行修改后的二进制文件数据库
shell> mysql -u root -p < tmpfile
不修改内容直接执行二进制日志文件编辑器
shell> mysqlbinlog binlog_files | mysql -u root -p
应使用单个数据库链接来执行要处理的全部二进制日志文件的内容日志
shell> mysqlbinlog binlog.000001 binlog.000002 | mysql -u root -p # 将整个日志写入单个文件,而后处理该文件 shell> mysqlbinlog binlog.000001 > /tmp/statements.sql shell> mysqlbinlog binlog.000002 >> /tmp/statements.sql shell> mysql -u root -p -e "source /tmp/statements.sql"