content_image/860879.jpg
<img src='content_image/860879.jpg'>

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 ... INTO var_list  statements, 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 13.6.7.2, “DECLARE ... HANDLER Statement” . For statements that may retrieve multiple rows, another strategy is to use LIMIT 1 to limit the result set to a single row. 

## 25.4.6 The Event Scheduler and MySQL Privileges 

To enable or disable the execution of scheduled events, it is necessary to set the value of the global event_scheduler  system variable. This requires privileges sufficient to set global system variables. See Section 5.1.9.1, “System Variable Privileges” . 

The EVENT  privilege governs the creation, modification, and deletion of events. This privilege can be bestowed using GRANT . For example, this GRANT  statement confers the EVENT  privilege for the schema named myschema  on the user jon@ghidora : 

GRANT EVENT ON myschema.* TO jon@ghidora; 

(We assume that this user account already exists, and that we wish for it to remain unchanged otherwise.) 

To grant this same user the EVENT  privilege on all schemas, use the following statement: 

GRANT EVENT ON *.* TO jon@ghidora; 

The EVENT  privilege has global or schema-level scope. Therefore, trying to grant it on a single table results in an error as shown: 

mysql> GRANT EVENT ON myschema.mytable TO jon@ghidora; ERROR 1144 (42000): Illegal GRANT/REVOKE command; please consult the manual to see which privileges can be used 

It is important to understand that an event is executed with the privileges of its definer, and that it cannot perform any actions for which its definer does not have the requisite privileges. For example, suppose that jon@ghidora  has the EVENT  privilege for myschema . Suppose also that this user has the SELECT privilege for myschema , but no other privileges for this schema. It is possible for jon@ghidora  to create a new event such as this one: 

CREATE EVENT e_store_ts ON SCHEDULE EVERY 10 SECOND DO INSERT INTO myschema.mytable VALUES (UNIX_TIMESTAMP()); 

