Open In App

How To Disable the Running Event in MySQL?

Last Updated : 30 Jan, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Pre-requisites:  create an event in MySQL, Events in MySQL

Events in MySQL are tasks that run according to a defined Schedule. events are executed based on schedule so it is also called a Scheduled event. In this article, we will talk about disabling running events.

Steps for Disable the Running Event in MySQL

Step 1: Firstly we need to check for All running events.

SHOW EVENTS:

Output:

Running events

Step 2: In order to disable the running event. we can use ALTER statement.

Syntax:

ALTER EVENT event_name
 DISABLE;

Query:

ALTER EVENT LOG_QTY DISABLE;

Output:

 

Step 3: Now let’s verify whether the event is still running or not.

 

As we can see that now there is no running event.

Where this Can be used?

  1.  Data analysis for analyzing user login activities and keeping that information only for a certain time. 
  2. In data collection, E-commerce websites may use this event to collect purchase information of customers during the festival sale, and then they can disable these events. 

So, this is how an event can be disabled we can create an event for a certain amount of time then we can disable it this way.


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads