Mysql View timer Open Timer Set timer time

Source: Internet
Author: User
Tags mysql create mysql view

11. Check to see if Evevt is turned on and on Evevt. 2 31.1, MySQL evevt feature is turned off by default, you can use the following statement to see the state of evevt, if it is off or 0, the expression is closed. 4Show VARIABLES like '%sche% ';51.2, turn on evevt function6SET GLOBAL Event_scheduler = 1;72the process of creating a timer82.1, creating a test table tests9drop tableifexists test;Ten CREATE TABLE Test One ( AIdint(one) notNULLauto_increment primary KEY, -Time datetime notNULL -) Engine=innodbdefaultcharset=UTF8; the2.2, create a stored procedure to invoke Evevt Test_proce -Delimiter// -drop procedureifExists Test_proce// - CREATE PROCEDURE Test_proce () + begin - INSERT INTO Test (time) values (now ()); +End// A delimiter; at2.3, turn on evevt (to make the timer work, MySQL's constant global event_scheduler must be on or 1) -Execute show variables like ' Event_scheduler '; see if the evevt is open; -If the Execute set global event_scheduler= ' on ' is not turned on; -2.4, create an event test_event (its role: automatically calls the TEST_PROCE () stored procedure every second) -Drop Eventifexists test_event; - Create Event Test_event inOn schedule every 1Second - On Completion Preserve disable to  DoCall Test_proce (); +2.5, turn on event test_event - Alter event test_event on completion preserve enable; the2.6, Shutdown event test_event * Alter event test_event on completion preserve disable; $2.7, view table testPanax NotoginsengSELECT *from test; -  the3. View the event you created + If you want to see more detailed information, you need the root user's authorization, if it is your own database you can use the following statement to view ASELECT *From mysql.event; the See the results of my evevt below + MySQL Create timer (event), view timer, turn on timer, set timer time -  $4time settings for. Event $ Setting the event is simple, but the trouble is how to set the execution time, online to find some, I summed up a bit.  - look at the statement first, as in the following -CREATE EVENT test_event on SCHEDULE Every 1 day starts ' 2012-09-24 00:00:00 ' the On completion PRESERVE ENABLE does call Test_procedure (); -Every back is the time interval, you can choose 1 second,3 minute,5 hour,9 day,1 month,1 Quarter (quarter), 1 YearWuyi starting from January 13, 2013 0 o'clock, run once a day theOn SCHEDULE every 1 day starts ' 2013-01-13 00:00:00 ' - regular execution every nine days from now on WuOn SCHEDULE every 9Day starts now (); - every month the number 1 o'clock in the morning executes AboutOn schedule every 1 month starts Date_add (Date_add (Date_sub (), Curdate Day (interval ()) – 1 day), Curdate 1 month), Interval 1hour); $ every quarter of the 1 o'clock in the morning execution -On schedule Every 1 quarter starts date_add (Date_add (Date (Concat (Curdate ()), '-', ELT (quarter (Curdate ()), 1,4,7,10 ), '-', 1), Interval 1 quarter), Interval 1hour); - executed every January 1 1 o'clock in the morning -On schedule Every 1 quarter starts date_add (Date_add (Date (Concat (Curdate ()), '-', ELT (quarter (Curdate ()), 1,4,7,10 ), '-', 1 '), Interval 1 quarter), interval 1 hour);

Mysql View timer Open Timer Set timer time

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.