The Event Scheduler writes information about event execution that terminates with an error or warning to the MySQL Server's error log. See Section 19.4.6, “The Event Scheduler and MySQL Privileges” for an example. (Before MySQL 5.1.31, the Event Scheduler also logged messages when events started execution and terminated successfully.)
Information about the state of the Event Scheduler for debugging and troubleshooting purposes can be obtained as follows:
In debugging builds of MySQL 5.1.11, you can use the
SHOW SCHEDULER STATUSstatement; see Section 220.127.116.11, “
SHOW SCHEDULER STATUSSyntax”. This statement was removed in MySQL 5.1.12. We intend to implement an SQL statement providing similar functionality in a future MySQL release.
Beginning with MySQL 5.1.12, event scheduler status information can be obtained by running mysqladmin debug (see Section 4.5.2, “mysqladmin — Client for Administering a MySQL Server”); after running this command, the server's error log contains output relating to the Event Scheduler, similar to what is shown here:
Events status: LLA = Last Locked At LUA = Last Unlocked At WOC = Waiting On Condition DL = Data Locked Event scheduler status: State : INITIALIZED Thread id : 0 LLA : init_scheduler:313 LUA : init_scheduler:318 WOC : NO Workers : 0 Executed : 0 Data locked: NO Event queue status: Element count : 1 Data locked : NO Attempting lock : NO LLA : init_queue:148 LUA : init_queue:168 WOC : NO Next activation : 0000-00-00 00:00:00
In statements that occur as part of events executed by the Event Scheduler, diagnostics messages (not only errors, but also warnings) are written to the error log, and, on Windows, to the application event log. For frequently executed events, it is possible for this to result in many logged messages. For example, for
SELECT ... INTOstatements, if the query returns no rows, a warning with error code 1329 occurs (
No data), and the variable values remain unchanged. If the query returns multiple rows, error 1172 occurs (
Result consisted of more than one row). For either condition, you can avoid having the warnings be logged by declaring a condition handler; see Section 18.104.22.168, “
DECLAREfor Handlers”. For statements that may retrieve multiple rows, another strategy is to use
LIMIT 1to limit the result set to a single row.