Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding when MySql event last ran

Tags:

mysql

I created an MySql event a few days ago. I don't think it has run. If I do SHOW EVENTS It started on 2015-09-07 00:00:00 and it has an interval of WEEK. Today is 2015-09-14 and it is well after midnight. It has a status of ENABLED. How do I know a) when it last ran, b) what it is supposed to do.

I created an SP which it was supposed to run. I tested this at the time but there is not sign that the SP has been run.

Is there any easy way to debug this? Or even a hard way?!

like image 418
Rob Sedgwick Avatar asked Sep 14 '15 20:09

Rob Sedgwick


People also ask

How do I see running events in MySQL?

SELECT * FROM INFORMATION_SCHEMA. events; You can also use SHOW CREATE EVENT yourevent to see what it does.

How does event work in MySQL?

MySQL Events are tasks that run according to a schedule. Therefore, we sometimes refer to them as scheduled events. When you create an event, you are creating a named database object containing one or more SQL statements to be executed at one or more regular intervals, beginning and ending at a specific date and time.

How do I edit a event in MySQL?

It isn't possible within MySQL to change the name of an event. Instead, use the DROP EVENT statement to delete an existing event and then create it again with a new name using CREATE EVENT. You can use the SHOW CREATE EVENT statement to be sure that all other parameters are the same.


1 Answers

This information is available through events in INFORMATION_SCHEMA. See LAST_EXECUTED column:

SELECT * FROM INFORMATION_SCHEMA.events; 

You can also use SHOW CREATE EVENT yourevent to see what it does.

like image 142
vhu Avatar answered Oct 14 '22 14:10

vhu