How to set a timer in mysql(如何在mysql中设置计时器)
问题描述
假设当前日期是 20141110 10:00pm ,我想让 mysql 更新一个字段,然后将几个字段转储到一个文件中,而日期是 20141201 10:00pm
Suppose the current date is 20141110 10:00pm , I would like to let mysql to update a field and then dump few fields into a file while the date is 20141201 10:00pm
如何实现?
我所知道的是使用事件,但这似乎是在某些间隔时间下使用的.就像每隔几个小时/天/周让事件发生.
What I know is to use event, but this seems to be used under some interval time. like every few hours/days/weeks to make the event happen.
推荐答案
您可以为活动的时间表声明一个固定的时间点.间隔部分是可选的.
You can declare a fixed point in time for the event's schedule. The interval part is optional.
这是出现在手册页上的示例 http://dev.mysql.com/doc/refman/5.6/en/create-event.html
Here's an example that appears on manual page http://dev.mysql.com/doc/refman/5.6/en/create-event.html
mysql> CREATE EVENT e_totals
-> ON SCHEDULE AT '2006-02-10 23:59:00'
-> DO INSERT INTO test.totals VALUES (NOW());
另请注意,您不必使用存储过程.
Note also that you do not have to use a stored procedure.
这篇关于如何在mysql中设置计时器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在mysql中设置计时器
基础教程推荐
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
- 是否可以执行按位分组功能? 2021-01-01
- 在 SQL 中连接多个表 2021-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- 无法解决整理冲突 2021-01-01
