15.USER_VAR_EVENT
执行包含了用户变量的语句产生此事件,此事件没有被用在binlog_format为ROW模式的情况下;
mysql> set @age=50;Query OK, 0 rows affected (0.00 sec) mysql> insert into btest (age,name)values(@age,'zhaohui');Query OK, 1 row affected (0.12 sec) mysql> show binlog events in 'bin-log.000003';+----------------+-----+-------------+-----------+-------------+------------------------------------------------------------------+| Log_name | Pos | Event_type | Server_id | End_log_pos | Info |+----------------+-----+-------------+-----------+-------------+------------------------------------------------------------------+...... || bin-log.000003 | 615 | Query | 1 | 683 | BEGIN || bin-log.000003 | 683 | Intvar | 1 | 711 | INSERT_ID=4 || bin-log.000003 | 711 | User var | 1 | 756 | @`age`=50 || bin-log.000003 | 756 | Query | 1 | 869 | use `test`; insert into btest (age,name)values(@age,'zhaohui') || bin-log.000003 | 869 | Xid | 1 | 896 | COMMIT /* xid=70 */ |+----------------+-----+-------------+-----------+-------------+------------------------------------------------------------------+15 rows in set (0.00 sec)16.FORMAT_DESCRIPTION_EVENT
描述事件,被写在每个binlog文件的开始位置,用在MySQL5.0以后的版本中,代替了START_EVENT_V3
mysql> show binlog events in 'bin-log.000003';+----------------+-----+-------------+-----------+-------------+---------------------------------------------------------------+| Log_name | Pos | Event_type | Server_id | End_log_pos | Info |+----------------+-----+-------------+-----------+-------------+---------------------------------------------------------------+| bin-log.000003 | 4 | Format_desc | 1 | 107 | Server ver: 5.5.29-log, Binlog ver: 4 |......17.XID_EVENT
支持XA的存储引擎才有,本地测试的数据库存储引擎是innodb,所有上面出现了XID_EVENT;innodb事务提交产生了QUERY_EVENT的BEGIN声明,QUERY_EVENT以及COMMIT声明,
如果是myIsam存储引擎也会有BEGIN和COMMIT声明,只是COMMIT类型不是XID_EVENT;
18.BEGIN_LOAD_QUERY_EVENT和EXECUTE_LOAD_QUERY_EVENT
执行LOAD DATA INFILE 语句时产生此事件,在MySQL5.0版本中使用;
mysql> LOAD DATA INFILE "D:/btest.sql" INTO TABLE test.btest FIELDS TERMINATED BY ',';Query OK, 1 row affected (0.11 sec)Records: 1 Deleted: 0 Skipped: 0 Warnings: 0 mysql> show binlog events in 'bin-log.000003';+----------------+------+--------------------+-----------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+| Log_name | Pos | Event_type | Server_id | End_log_pos | Info |+----------------+------+--------------------+-----------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+...... || bin-log.000003 | 896 | Query | 1 | 964 | BEGIN || bin-log.000003 | 964 | Begin_load_query | 1 | 1008 | ;file_id=3;block_len=21 || bin-log.000003 | 1008 | Execute_load_query | 1 | 1237 | use `test`; LOAD DATA INFILE 'D:/btest.sql' INTO TABLE `btest` FIELDS TERMINATED BY ',' ENCLOSED BY '' ESCAPED BY '\' LINES TERMINATED BY 'n' (`id`, `age`, `name`) ;file_id=3 || bin-log.000003 | 1237 | Xid | 1 | 1264 | COMMIT /* xid=148 */ |+----------------+------+--------------------+-----------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+19 rows in set (0.00 sec)btest.sql内容如下:
999, 101, 'zhaohui'19.TABLE_MAP_EVENT
用在binlog_format为ROW模式下,将表的定义映射到一个数字,在行操作事件之前记录(包括:WRITE_ROWS_EVENT,UPDATE_ROWS_EVENT,DELETE_ROWS_EVENT);
mysql> insert into btest values(998,88,'zhaohui');Query OK, 1 row affected (0.09 sec) mysql> show binlog events in 'bin-log.000004';+----------------+-----+-------------+-----------+-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+| Log_name | Pos | Event_type | Server_id | End_log_pos | Info |+----------------+-----+-------------+-----------+-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+...... || bin-log.000004 | 776 | Query | 1 | 844 | BEGIN || bin-log.000004 | 844 | Table_map | 1 | 892 | table_id: 33 (test.btest) || bin-log.000004 | 892 | Write_rows | 1 | 943 | table_id: 33 flags: STMT_END_F || bin-log.000004 | 943 | Xid | 1 | 970 | COMMIT /* xid=20 */ |+----------------+-----+-------------+-----------+-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+14 rows in set (0.00 sec)
推荐阅读
- MySQL中的这17个关键问题,一定要弄清楚
- 海南鲨鱼袭击事件 蜈支洲岛有鲨鱼吗
- 僵尸先生背后灵异事件 新僵尸先生拍摄期间的灵异事件
- MySQL DBA必读:万字归总表设计与SQL编写技巧
- 详解Mysql数据库不同字符集下迁移方法
- Mysql数据库连接查询
- mysql 数据分析如何实现日报、周报、月报和年报?
- 世界上不可思议的巧合事件 世界上惊人的25个巧合
- MySQL 触发器
- 茶叶的10个奇葩事件 第6个太震惊了