MYSQL-event
2013-10-11 21:13
211 查看
1、开启事务: mysql> show variables like 'event_scheduler' -> ; +-----------------+-------+ | Variable_name | Value | +-----------------+-------+ | event_scheduler | OFF | +-----------------+-------+ 1 row in set (0.00 sec)
mysql> set global event_scheduler=1; Query OK, 0 rows affected (0.00 sec)
mysql> show variables like 'event_scheduler'; +-----------------+-------+ | Variable_name | Value | +-----------------+-------+ | event_scheduler | ON | +-----------------+-------+ 1 row in set (0.00 sec)
2、编写事务: create event e_test_insert on schedule every 1 second do insert into test.a values(current_timestamp);
3、查看结果: mysql> select * from a; +---------------------+ | timeline | +---------------------+ | 2013-10-11 21:17:41 | | 2013-10-11 21:17:42 | | 2013-10-11 21:17:43 | | 2013-10-11 21:17:44 | | 2013-10-11 21:17:45 | | 2013-10-11 21:17:46 | | 2013-10-11 21:17:47 | | 2013-10-11 21:17:48 | | 2013-10-11 21:17:49 | | 2013-10-11 21:17:50 | | 2013-10-11 21:17:51 | | 2013-10-11 21:17:52 | | 2013-10-11 21:17:53 | | 2013-10-11 21:17:54 | | 2013-10-11 21:17:55 | | 2013-10-11 21:17:56 | | 2013-10-11 21:17:57 | | 2013-10-11 21:17:58 | | 2013-10-11 21:17:59 | | 2013-10-11 21:18:00 | | 2013-10-11 21:18:01 | | 2013-10-11 21:18:02 | | 2013-10-11 21:18:03 | | 2013-10-11 21:18:04 | | 2013-10-11 21:18:05 | | 2013-10-11 21:18:06 | | 2013-10-11 21:18:07 | | 2013-10-11 21:18:08 | | 2013-10-11 21:18:09 | | 2013-10-11 21:18:10 | | 2013-10-11 21:18:11 | | 2013-10-11 21:18:12 | | 2013-10-11 21:18:13 | | 2013-10-11 21:18:14 | | 2013-10-11 21:18:15 | | 2013-10-11 21:18:16 | | 2013-10-11 21:18:17 | | 2013-10-11 21:18:18 | | 2013-10-11 21:18:19 | | 2013-10-11 21:18:20 | | 2013-10-11 21:18:21 | | 2013-10-11 21:18:22 | | 2013-10-11 21:18:23 | | 2013-10-11 21:18:24 | | 2013-10-11 21:18:25 | | 2013-10-11 21:18:26 | | 2013-10-11 21:18:27 | | 2013-10-11 21:18:28 | | 2013-10-11 21:18:29 | | 2013-10-11 21:18:30 | | 2013-10-11 21:18:31 | | 2013-10-11 21:18:32 | | 2013-10-11 21:18:33 | | 2013-10-11 21:18:34 | | 2013-10-11 21:18:35 | | 2013-10-11 21:18:36 | | 2013-10-11 21:18:37 | | 2013-10-11 21:18:38 | | 2013-10-11 21:18:39 | | 2013-10-11 21:18:40 | | 2013-10-11 21:18:41 | | 2013-10-11 21:18:42 | | 2013-10-11 21:18:43 | | 2013-10-11 21:18:44 | | 2013-10-11 21:18:45 | | 2013-10-11 21:18:46 | | 2013-10-11 21:18:47 | | 2013-10-11 21:18:48 | | 2013-10-11 21:18:49 | | 2013-10-11 21:18:50 | | 2013-10-11 21:18:51 | | 2013-10-11 21:18:52 | | 2013-10-11 21:18:53 | | 2013-10-11 21:18:54 | | 2013-10-11 21:18:55 | | 2013-10-11 21:18:56 | | 2013-10-11 21:18:57 | | 2013-10-11 21:18:58 | | 2013-10-11 21:18:59 | | 2013-10-11 21:19:00 | | 2013-10-11 21:19:01 | | 2013-10-11 21:19:02 | | 2013-10-11 21:19:03 | | 2013-10-11 21:19:04 | | 2013-10-11 21:19:05 | | 2013-10-11 21:19:06 | | 2013-10-11 21:19:07 | | 2013-10-11 21:19:08 | | 2013-10-11 21:19:09 | | 2013-10-11 21:19:10 | | 2013-10-11 21:19:11 | | 2013-10-11 21:19:12 | | 2013-10-11 21:19:13 | | 2013-10-11 21:19:14 | | 2013-10-11 21:19:15 | +---------------------+ 95 rows in set (0.00 sec)
事务正在运行中;
4、停止事务: mysql> alter event e_test_insert disable;
5、开启事务:
mysql> alter event e_test_insert enable; Query OK, 0 rows affected (0.00 sec)
mysql> set global event_scheduler=1; Query OK, 0 rows affected (0.00 sec)
mysql> show variables like 'event_scheduler'; +-----------------+-------+ | Variable_name | Value | +-----------------+-------+ | event_scheduler | ON | +-----------------+-------+ 1 row in set (0.00 sec)
2、编写事务: create event e_test_insert on schedule every 1 second do insert into test.a values(current_timestamp);
3、查看结果: mysql> select * from a; +---------------------+ | timeline | +---------------------+ | 2013-10-11 21:17:41 | | 2013-10-11 21:17:42 | | 2013-10-11 21:17:43 | | 2013-10-11 21:17:44 | | 2013-10-11 21:17:45 | | 2013-10-11 21:17:46 | | 2013-10-11 21:17:47 | | 2013-10-11 21:17:48 | | 2013-10-11 21:17:49 | | 2013-10-11 21:17:50 | | 2013-10-11 21:17:51 | | 2013-10-11 21:17:52 | | 2013-10-11 21:17:53 | | 2013-10-11 21:17:54 | | 2013-10-11 21:17:55 | | 2013-10-11 21:17:56 | | 2013-10-11 21:17:57 | | 2013-10-11 21:17:58 | | 2013-10-11 21:17:59 | | 2013-10-11 21:18:00 | | 2013-10-11 21:18:01 | | 2013-10-11 21:18:02 | | 2013-10-11 21:18:03 | | 2013-10-11 21:18:04 | | 2013-10-11 21:18:05 | | 2013-10-11 21:18:06 | | 2013-10-11 21:18:07 | | 2013-10-11 21:18:08 | | 2013-10-11 21:18:09 | | 2013-10-11 21:18:10 | | 2013-10-11 21:18:11 | | 2013-10-11 21:18:12 | | 2013-10-11 21:18:13 | | 2013-10-11 21:18:14 | | 2013-10-11 21:18:15 | | 2013-10-11 21:18:16 | | 2013-10-11 21:18:17 | | 2013-10-11 21:18:18 | | 2013-10-11 21:18:19 | | 2013-10-11 21:18:20 | | 2013-10-11 21:18:21 | | 2013-10-11 21:18:22 | | 2013-10-11 21:18:23 | | 2013-10-11 21:18:24 | | 2013-10-11 21:18:25 | | 2013-10-11 21:18:26 | | 2013-10-11 21:18:27 | | 2013-10-11 21:18:28 | | 2013-10-11 21:18:29 | | 2013-10-11 21:18:30 | | 2013-10-11 21:18:31 | | 2013-10-11 21:18:32 | | 2013-10-11 21:18:33 | | 2013-10-11 21:18:34 | | 2013-10-11 21:18:35 | | 2013-10-11 21:18:36 | | 2013-10-11 21:18:37 | | 2013-10-11 21:18:38 | | 2013-10-11 21:18:39 | | 2013-10-11 21:18:40 | | 2013-10-11 21:18:41 | | 2013-10-11 21:18:42 | | 2013-10-11 21:18:43 | | 2013-10-11 21:18:44 | | 2013-10-11 21:18:45 | | 2013-10-11 21:18:46 | | 2013-10-11 21:18:47 | | 2013-10-11 21:18:48 | | 2013-10-11 21:18:49 | | 2013-10-11 21:18:50 | | 2013-10-11 21:18:51 | | 2013-10-11 21:18:52 | | 2013-10-11 21:18:53 | | 2013-10-11 21:18:54 | | 2013-10-11 21:18:55 | | 2013-10-11 21:18:56 | | 2013-10-11 21:18:57 | | 2013-10-11 21:18:58 | | 2013-10-11 21:18:59 | | 2013-10-11 21:19:00 | | 2013-10-11 21:19:01 | | 2013-10-11 21:19:02 | | 2013-10-11 21:19:03 | | 2013-10-11 21:19:04 | | 2013-10-11 21:19:05 | | 2013-10-11 21:19:06 | | 2013-10-11 21:19:07 | | 2013-10-11 21:19:08 | | 2013-10-11 21:19:09 | | 2013-10-11 21:19:10 | | 2013-10-11 21:19:11 | | 2013-10-11 21:19:12 | | 2013-10-11 21:19:13 | | 2013-10-11 21:19:14 | | 2013-10-11 21:19:15 | +---------------------+ 95 rows in set (0.00 sec)
事务正在运行中;
4、停止事务: mysql> alter event e_test_insert disable;
5、开启事务:
mysql> alter event e_test_insert enable; Query OK, 0 rows affected (0.00 sec)
相关文章推荐
- 【CF 应用开发大赛】IT Share(IT分享网)
- IT职场英语,必须学会
- it人员要看饮食保健养生谚语
- 个人随笔——衰人自叙卷壹
- IT人员迅速提升自我效率的十大方法
- 搞IT的到底怎么了
- 史蒂夫-乔布斯十大励志名言(中英对照)
- 大学生IT求职,不缺机会,积累项目实战经验是关键
- 职业规划和技术发展
- 奥运对中国IT行业的影响
- 某大型IT公司招网络工程师认证试题精选(要求:CCNA或HCNE以上)
- 全国信息化工程师院校IT双证书职业课程认证
- 游侠推荐:降级论
- 浅谈IT管理
- 第一部分 思科九年 一(8)
- 职场中不可深交的5类人
- 注册表键值大全,***常用命令和快捷键
- 还是转载了,通俗易懂
- ThinkInLAMP首届架构师大会将于2012 年6月17日在上海举行
- Cobit