2013-08-23 9 views
5

Ich habe ein Ereignis erstellt. Es läuft auf die Zeit, zu der ich es erstellt habe. Aber ich möchte das Ereignis ausführen, wenn mysql Server gestartet wird. Zum Beispiel habe ich ein Ereignis namens CL_PL_CREDIT Code wie folgt aussieht erstellt haben,Event Scheduling beim Start mysql

delimiter | 

CREATE EVENT RURALSHORES2.UpLv 
    ON SCHEDULE 
     EVERY 1 MONTH 
    DO 
     BEGIN 
     update emp_lv_rem set cl_count=cl_count+1,pl_count=pl_count+1.25 where emp_id in (select emp_id from emp_main where EmploymentType="Permanent" or EmploymentType="Regular"); 
     update emp_lv_rem set cl_count=1,pl_count=1 where emp_id in (select emp_id from emp_main where EmploymentType="Probation"); 
     update emp_lv_rem set cl_count=1,pl_count=0 where emp_id in (select emp_id from emp_main where EmploymentType="Contract" or EmploymentType="Partime" or EmploymentType="Trainee" or EmploymentType="Consultant"); 
update emp_lv_rem set cl_count=0,pl_count=0 where emp_id in (select emp_id from emp_main where EmploymentType="Contract" and EmploymentType<>"Partime" and EmploymentType<>"Trainee" and EmploymentType<>"Consultant" and EmploymentType="Permanent" and EmploymentType="Regular" and EmploymentType="Probation"); 

    END |; 

delimiter ; 

Wenn ich Show-Events, damit er als zeigt beginnt 2013.08.23 10.42.53, aber ich will es auf jeden laufen 1. Tag des Monats, an dem der Server gestartet wird.

+0

Haben Sie bedeuten, dass der Neustart des Servers jeden 1. Tag des Monats, und dass Sie das Ereignis ausgeführt werden soll, wenn der Server neu starten, oder möchten Sie das Ereignis jeden 1. Tag ausführen? – RenkyaZ

Antwort

1

Um es jeden ersten Tag des Monats auszuführen, sollten Sie das Startdatum hinzufügen:

ON SCHEDULE 
    EVERY 1 MONTH 
    STARTS AT '2013-09-01 00:00:00'