我们如何修改现有的 MySQL 事件?
技术百科
WBOY
发布时间:2023-08-27
浏览: 次 借助 ALTER EVENT 语句,我们可以修改现有的 MySQL 事件。我们可以更改事件的各种属性。ALTER EVENT 的语法如下:
ALTER EVENT event_name
ON SCHEDULE schedule
ON COMPLETION [NOT] PRESERVE
RENAME TO new_event_name
ENABLE | DISABLE
DO
event_body为了理解它,我们将举例说明如下 -
示例
假设我们有一个事件,如下 -
mysql> Create event hello ON SCHEDULE EVERY 1 Minute DO INSERT INTO event_messages(message, generated_at) Values ('Alter event testing', NOW());
Query OK, 0 rows affected (0.00 sec)
mysql> select * from event_messages;
+----+---------------------+---------------------+
| ID | MESSAGE | Generated_at |
+----+---------------------+---------------------+
| 1 | Without Preserve | 2017-11-22 20:32:13 |
| 2 | With Preserve | 2017-11-22 20:35:12 |
| 3 | Alter event testing | 2017-11-22 21:08:37 |
+----+---------------------+---------------------+
3 rows in set (0.00 sec)
mysql> ALTER EVENT hello ON SCHEDULE EVERY 2 MINUTE;
Query OK, 0 rows affected (0.00 sec)上述查询会将事件的时间表从 1 分钟更改为 2 分钟。下面的查询将更改事件的正文。
mysql> ALTER EVENT hello DO INSERT INTO event_messages(message,generated_at) VALUES('ALTERED',NOW());
Query OK, 0 rows affected (0.00 sec)
mysql> select * from event_messages;
+----+---------------------+---------------------+
| ID | MESSAGE | Generated_at |
+----+---------------------+---------------------+
| 1 | Without Preserve | 2017-11-22 20:32:13 |
| 2 | With Preserve | 2017-11-22 20:35:12 |
| 3 | Alter event testing | 2017-11-22 21:08:37 |
| 4 | Alter event testing | 2017-11-22 21:
09:15 |
| 5 | ALTERED | 2017-11-22 21:11:15 |
+----+---------------------+---------------------+
5 rows in set (0.00 sec)上面的结果集显示我们在2分钟后收到了更改的消息。
# 有一个
# 我们可以
# 会将
# 收到了
# 事件
# Event
# mysql
# 分钟后
# Create
# 举例说明
相关栏目:
<?muma
$count = M('archives')->where(['typeid'=>$field['id']])->count();
?>
【
AI推广<?muma echo $count; ?>
】
<?muma
$count = M('archives')->where(['typeid'=>$field['id']])->count();
?>
【
SEO优化<?muma echo $count; ?>
】
<?muma
$count = M('archives')->where(['typeid'=>$field['id']])->count();
?>
【
技术百科<?muma echo $count; ?>
】
<?muma
$count = M('archives')->where(['typeid'=>$field['id']])->count();
?>
【
谷歌推广<?muma echo $count; ?>
】
<?muma
$count = M('archives')->where(['typeid'=>$field['id']])->count();
?>
【
百度推广<?muma echo $count; ?>
】
<?muma
$count = M('archives')->where(['typeid'=>$field['id']])->count();
?>
【
网络营销<?muma echo $count; ?>
】
<?muma
$count = M('archives')->where(['typeid'=>$field['id']])->count();
?>
【
案例网站<?muma echo $count; ?>
】
<?muma
$count = M('archives')->where(['typeid'=>$field['id']])->count();
?>
【
精选文章<?muma echo $count; ?>
】
相关推荐
- PHP主流架构如何做单元测试_工具与流程【详解】
- Win11如何设置电源计划_Win11电源计划优化
- Windows10如何更改鼠标图标_Win10鼠标
- 如何在Golang中处理JSON字段缺失_Gola
- PHP cURL GET请求:正确设置请求头与身份
- Win11应用商店下载慢怎么办 Win11更改DN
- Win10怎样卸载自带Edge_Win10卸载Ed
- php订单日志怎么在swoole写_php协程sw
- Windows10电脑怎么设置防火墙出站规则_Wi
- Windows 11无法安全删除U盘提示设备正在使
- 如何使用Golang实现文件加密_Golang c
- PHP主流架构怎么部署到Docker_容器化流程【
- 如何在 Go 中判断变量是否为函数类型
- php下载安装包怎么选_threadsafe与nt
- 如何在 Go 中正确测试带 Cookie 的 HT
- 如何使用正则表达式提取以编号开头、后跟多个注解的完
- Win11怎么关闭内容自适应亮度_Windows1
- Win11怎样安装企业微信_Win11安装企业微信
- Win10怎样设置多显示器_Win10多显示器扩展
- 如何在 Go 中正确反序列化多个同级 XML 元素
- 如何快速验证Golang安装是否成功_运行go v
- Windows10如何更改开机密码_Win10登录
- Win11怎么连接投影仪_Win11多显示器投屏设
- Mac怎么开启“任何来源”_Mac安装未签名应用的
- Win10怎样卸载DockerDesktop_Wi
- Win11怎么开启远程桌面_Win11系统远程桌面
- 如何在 Go 后端安全获取并验证前端存储的 JWT
- php打包exe后无法读取环境变量_变量配置方法【
- Win11笔记本怎么看电池健康度_Win11电池报
- Win11怎么设置DNS服务器_Windows11
- c++怎么设置线程优先级与cpu亲和性_c++ 多
- 如何在 IIS 上为 ASP.NET 6 应用排除
- Win10怎样卸载iTunes_Win10卸载iT
- Python数据挖掘进阶教程_分类回归与聚类案例解
- Go 中 defer 在 goroutine 内部
- php8.4xdebug无法调试怎么办_php8.
- 如何使用Golang捕获并记录协程panic_保证
- C#怎么使用委托和事件 C# delegate与e
- 用Python构建微服务架构实践_FastAPI与
- Win10怎么卸载迅雷_Win10彻底卸载迅雷方法
- How to Properly Use NumPy
- 如何在 PHP 单元测试中正确模拟带方法的图像处理
- ACF 教程:正确更新嵌套在多层 Group 字段
- Win11怎么硬盘分区 Win11新建磁盘分区详细
- php485能和物联网模块通信吗_php485对接
- Win11怎么更改任务栏位置_修改注册表将Win1
- Win11怎么设置单手模式_Win11触控键盘布局
- Win11视频默认播放器怎么改_Win11关联第三
- LINUX怎么查看进程_LINUX ps命令查看运
- Windows10如何更改计算机工作组_Win10

09:15 |
| 5 | ALTERED | 2017-11-22 21:11:15 |
+----+---------------------+---------------------+
5 rows in set (0.00 sec)
QQ客服