如何删除MySQL中的所有事件 [英] How to delete all events in MySQL

查看:225
本文介绍了如何删除MySQL中的所有事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我要删除某个事件,我需要查询类似
DROP EVENT IF EXISTS eventname
但我找不到一次删除所有事件的命令,必须逐个删除事件。
有一些SQL一次删除所有事件?

 如果存在事件,则删除事件(SELECT EVENT_NAME FROM information_schema .EVENTS)

无效。

解决方案

示例一:

  DELETE FROM mysql.event 
WHERE db ='myschema'
AND definer ='jon @ ghidora'
AND name ='e_insert';

https://dev.mysql.com/doc/refman/5.1/en/events-privileges.html DROP EVENT IF EXISTS 删除事件,并使用新的预定时间重新添加该事件,则p>



要自行永久删除活动,您可以使用 DROP EVENT

  DROP EVENT [如果存在] event_name 

https://dev.mysql.com/doc /refman/5.1/en/drop-event.html


If I want to delete some event I need to query something like "DROP EVENT IF EXISTS eventname" But I can't find the command of deleting all the events at one time,must delete event one by one. Is there some SQL of deleting all events at one time?

"DROP EVENT IF EXISTS (SELECT EVENT_NAME FROM  information_schema.EVENTS)"

is not working either.

解决方案

sample one:

DELETE FROM mysql.event
    WHERE db = 'myschema'
      AND definer = 'jon@ghidora'
      AND name = 'e_insert';

https://dev.mysql.com/doc/refman/5.1/en/events-privileges.html

if you can delete the event with DROP EVENT IF EXISTS and re-add it with the new scheduled time.

To permanently delete an event yourself, you can use DROP EVENT:

DROP EVENT [IF EXISTS] event_name

https://dev.mysql.com/doc/refman/5.1/en/drop-event.html

这篇关于如何删除MySQL中的所有事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆