Database

Starting with MySQL Events

Today I am going to start the series of the articles. This series is about Basics of MySQL Events, Creating and Altering the Events, Managing the Events and all that. This article is about to cover Basics of MySQL Events.

What Is MySQL Events?

MySQL Events are just like an bunch of queries which we can execute on specific time. We can define this time while creating the Events in MySQL. Before you create an Events in MySQL you must have that enabled :).

Enable MySQL Events

Before directly enabling the MySQL Events let’s check the current status of your MySQL Server for Events. For this open your MySQL Qurery Browser and run below query.

[cc lang=”mysql”]
SHOW VARIABLES LIKE “EVENT_SCHEDULER”;
[/cc]

If above query returns the value [code]ON[/code] in front of ‘EVENT_SCHEDULER’, then you are good to skip the below steps. But if you get the result [code]OFF[/code] then you must have to follow below steps in order to enable MySQL Events.

For enabling the MySQL Events execute below query in your Query Browser.

[cc lang=”mysql”]
SET GLOBAL event_scheduler=ON;
[/cc]

Now to make sure you have enabled the MySQL events, you can again execute [code]SHOW VARIABLES LIKE ‘EVENT_SCHEDULER’;[/code]. If you now got the value ON then you have successfuly enabled MySQL Events in your server.

Another way to make sure that Events are enabled or not if to execute below query.

[cc lang=”mysql”]
SHOW PROCESSLIST;
[/cc]

Upon executing above query if you got one row which have value “event_scheduler” in “User” fields then you have MySQL Events are enabled properly.

What’s Next?

In this article you come to know how to check the status of the Events in MySQL Server and also How to Enable Events in MySQL Server.
Next article would be about creating and managing the MySQL Events. So keep in touch. You can subscribe to our RSS Feed to to get updated via email.

Shares:

Leave a Reply

Your email address will not be published. Required fields are marked *