Quantcast
Viewing latest article 1
Browse Latest Browse All 5

Answer by Rishi Gautam for How to schedule a stored procedure in MySQL

In order to create a cronjob, follow these steps:

  1. run this command : SET GLOBAL event_scheduler = ON;

  2. If ERROR 1229 (HY000): Variable 'event_scheduler' is a GLOBALvariable and should be set with SET GLOBAL: mportant

It is possible to set the Event Scheduler to DISABLED only at server startup. If event_scheduler is ON or OFF, you cannot set it to DISABLED at runtime. Also, if the Event Scheduler is set to DISABLED at startup, you cannot change the value of event_scheduler at runtime.

To disable the event scheduler, use one of the following two methods:

  1. As a command-line option when starting the server:

    --event-scheduler=DISABLED
  2. In the server configuration file (my.cnf, or my.ini on Windows systems):include the line where it will be read by the server (for example, in a [mysqld] section):

    event_scheduler=DISABLED

    Read MySQL documentation for more information.

     DROP EVENT IF EXISTS EVENT_NAME;  CREATE EVENT EVENT_NAME ON SCHEDULE EVERY 10 SECOND/minute/hour DO CALL PROCEDURE_NAME();

Viewing latest article 1
Browse Latest Browse All 5

Trending Articles