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中设置计时器


基础教程推荐
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- 带更新的 sqlite CTE 2022-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- 从字符串 TSQL 中获取数字 2021-01-01