mysql版本信息:
admin@localhost : test 02:56:06> select @@version;
+------------+
| @@version |
+------------+
| 5.5.24-log |
+------------+
实验:
(1) 在测试库test中创建表结构
CREATE TABLE `event` (
`A` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
(2) 创建事件,每隔2秒向表中插入一条数据,如下:
create event e_tab_insert on schedule every 2 second do insert into test.event values ('5');
(3) 查询event表中,没有发现任务数据;
(4)查看ERROR日志,错误如下:
140722 15:00:44 [ERROR] Event Scheduler: [admin@localhost][test.e_tab_insert] Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
查看事务的隔离级别和binlog日志,如下所示:
admin@localhost : test 02:50:52> select @@tx_isolation;
+----------------+
| @@tx_isolation |
+----------------+
| READ-COMMITTED |
+----------------+
admin@localhost : test 02:59:04> select @@binlog_format;
+-----------------+
| @@binlog_format |
+-----------------+
| STATEMENT |
+-----------------+
(5) 修改事务隔离级别后,事件能成功执行。
set global transaction isolation level repeatable read;
(6) 删除事务:
drop event e_tab_insert;
参考文档:
http://xinying.blog.51cto.com/441770/314203