警告:为LOAD DATA LOCAL语句创建的临时文件不会自动删除,因为在实际执行完那些语句前需要它们。不再需要语句日志后应自己删除临时文件。文件位于临时文件目录中,文件名类似original_file_name-#-#。
--hexdump选项可以在注释中产生日志内容的十六进制转储:
shell> mysqlbinlog --hexdump master-bin.000001上述命令的输出应类似:
/*!40019 SET @@session.max_insert_delayed_threads=0*/;/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;# at 4#051024 17:24:13 server id 1 end_log_pos 98# Position Timestamp Type Master ID Size Master Pos Flags# 00000004 9d fc 5c 43 0f 01 00 00 00 5e 00 00 00 62 00 00 00 00 00# 00000017 04 00 35 2e 30 2e 31 35 2d 64 65 62 75 67 2d 6c |..5.0.15.debug.l|# 00000027 6f 67 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |og..............|# 00000037 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|# 00000047 00 00 00 00 9d fc 5c 43 13 38 0d 00 08 00 12 00 |.......C.8......|# 00000057 04 04 04 04 12 00 00 4b 00 04 1a |.......K...|# Start: binlog v 4, server v 5.0.15-debug-log created 051024 17:24:13# at startupROLLBACK;十六进制转储的输出包含下面的元素:
·
Position: The byte position within the log file.
·
Timestamp: The event timestamp. In the example just shown, '9d fc 5c 43' is the representation of '051024 17:24:13' in hexadecimal.
·
Type: The type of the log event. '0f' means that the example event is a FORMAT_DESCRIPTION_EVENT. The types are:
·
00 UNKNOWN_EVENT·
This event should never be present in the log.·
01 START_EVENT_V3·
This indicates the start of a log file written by MySQL 4 or earlier.·
02 QUERY_EVENT·
The most common type of events. These contain queries executed·
on the master.·
03 STOP_EVENT·
Indicates that master has stopped.·
04 ROTATE_EVENT·
Written when the master switches to a new log file.·
05 INTVAR_EVENT·
Used mainly for AUTO_INCREMENT values and if the LAST_INSERT_ID()·
function is used in the statement.·
06 LOAD_EVENT·
Used for LOAD DATA INFILE in MySQL 3.23.·
07 SLAVE_EVENT·
Reserved for future use.·
08 CREATE_FILE_EVENT·
Used for LOAD DATA INFILE statements. This indicates the start·
of execution of such a statement. A temporary file is created·
on the slave. Used in MySQL 4 only.·
09 APPEND_BLOCK_EVENT·
Contains data for use in a LOAD DATA INFILE statement. The·
data is stored in the temporary file on the slave.·
0a EXEC_LOAD_EVENT·
Used for LOAD DATA INFILE statements. The contents of the·
temporary file is stored in the table on the slave.·
Used in MySQL 4 only.·
0b DELETE_FILE_EVENT·
Rollback of LOAD DATA INFILE statement. The temporary file·
should be deleted on slave.·
0c NEW_LOAD_EVENT·
Used for LOAD DATA INFILE in MySQL 4 and earlier.·
0d RAND_EVENT·
Used to send information about random values if the RAND()·
function is used in the query.·
0e USER_VAR_EVENT·
Used to replicate user variables.·
0f FORMAT_DESCRIPTION_EVENT·
This indicates the start of a log file written by MySQL 5 or later.·
10 XID_EVENT·
Event indicating commit of XA transaction·
11 BEGIN_LOAD_QUERY_EVENT·
Used for LOAD DATA statements in MySQL 5 and later.·
12 EXECUTE_LOAD_QUERY_EVENT·
Used for LOAD DATA statements in MySQL 5 and later.·
13 TABLE_MAP_EVENT·
Reserved for future use·
14 WRITE_ROWS_EVENT·
Reserved for future use·
15 UPDATE_ROWS_EVENT·
Reserved for future use·
16 DELETE_ROWS_EVENT·
Reserved for future use·
Master ID: The server id of the master that created the event.
·
Size: The size in bytes of the event.
·
Master Pos: The position of the event in the original master log file.
·
Flags: 16 flags.
·
01 LOG_EVENT_BINLOG_IN_USE_F·
Log file correctly closed (Used only in FORMAT_DESCRIPTION_EVENT)·
If this flag is set (if the flags are e.g. '01 00') in an·
FORMAT_DESCRIPTION_EVENT, then the log file has not been·
properly closed. Most probably because of a master crash (for·
example, due to power failure).·
02 Reserved for future use.·
04 LOG_EVENT_THREAD_SPECIFIC_F·
Set if the event is dependent on the connection it was·
executed in (example '04 00'), e.g. if the event uses·
temporary tables.·
08 LOG_EVENT_SUPPRESS_USE_F·
Set in some circumstances when the event is not dependent on·
the current database其它标志保留用于将来使用。
在以后的版本中十六进制转储输出的格式可能会改变。