网站删除模块,亿玫网站建设,门源县住房和城乡建设局网站,网页设计教程博主mysqlbinlog用于处理二进制的日志文件#xff0c;如果想要查看这些日志文件的文本内容#xff0c;就需要使用mysqlbinlog工具。1.mysqlbinlog命令的语法shell mysqlbinlog [options] logfile1 logfile2 ...2.mysqlbinlog的选项-d, --databasename 仅显示指定数据库的转储…mysqlbinlog用于处理二进制的日志文件如果想要查看这些日志文件的文本内容就需要使用mysqlbinlog工具。1.mysqlbinlog命令的语法shell mysqlbinlog [options] logfile1 logfile2 ...2.mysqlbinlog的选项-d, --databasename 仅显示指定数据库的转储内容。-o, --offset# 跳过前N行的日志条目。-r, --result-filename 将输入的文本格式的文件转储到指定的文件。-s, --short-form 使用简单格式。--set-charsetname 在转储文件的开头增加SET NAMES character_set语句。--start-datetimename 转储日志的起始时间。--stop-datetimename 转储日志的截止时间。-j, --start-position# 转储日志的起始位置。--stop-position# 转储日志的截止位置。3.示例查看二进制日志文件所在的位置方法如下mysql show variables like %log%;-------------------------------------------------------------------------------------....省略....| log_bin | OFF || log_bin_basename | || log_bin_index | || log_bin_trust_function_creators | OFF || log_bin_use_v1_row_events | OFF |....省略....-------------------------------------------------------------------------------------由以上输出可见log-bin的值为OFF所以必须首先打开log-bin方法如下vi /etc/my.cnf[mysqld]....省略....log-binbin-log # 等号后为log-bin文件的名称前缀名称可以自定义。转储log-binmysql use test;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql truncate table t1;Query OK, 0 rows affected (0.00 sec)mysql insert into t1 values(214);Query OK, 1 row affected (0.00 sec)mysql insert into t1 values (215);Query OK, 1 row affected (0.00 sec)---------------------------------------------------------------------------------------------------------------------# mysqlbinlog bin-log.000002....省略....use test/*!*/;....省略....truncate table t1/*!*/;# at 211#160830 7:28:36 server id 1 end_log_pos 290 CRC32 0x1f3368bb Query thread_id1 exec_time0 error_code0SET TIMESTAMP1472513316/*!*/;BEGIN/*!*/;# at 290#160830 7:28:36 server id 1 end_log_pos 390 CRC32 0xcf40a797 Query thread_id1 exec_time0 error_code0SET TIMESTAMP1472513316/*!*/;insert into t1 values(214)/*!*/;# at 390#160830 7:28:36 server id 1 end_log_pos 421 CRC32 0x9d9f8407 Xid 11COMMIT/*!*/;# at 421#160830 7:28:48 server id 1 end_log_pos 500 CRC32 0x722de8f9 Query thread_id1 exec_time0 error_code0SET TIMESTAMP1472513328/*!*/;BEGIN/*!*/;# at 500#160830 7:28:48 server id 1 end_log_pos 601 CRC32 0x03e2087d Query thread_id1 exec_time0 error_code0SET TIMESTAMP1472513328/*!*/;insert into t1 values (215)/*!*/;# at 601#160830 7:28:48 server id 1 end_log_pos 632 CRC32 0x062775e4 Xid 12COMMIT/*!*/;DELIMITER ;# End of log file