To see if the event Scheduler is currently turned on
Show VARIABLES like ' Event_scheduler ';
Open Event Viewer
SET GLOBAL event_scheduler = 1;
Creating events
Grammar:
CREATE EVENT [IF not EXISTS] Event_Name
On SCHEDULE SCHEDULE
[on completion [NOT] PRESERVE]
[ENABLE | DISABLE]
[COMMENT ' COMMENT ']
Do sql_statement;
Instance:
CREATE EVENT Updateinfostatus
On SCHEDULE EVERY MINUTE
Todo
UPDATE ' jd_article ' SET ' status ' = 0 WHERE ' status ' = 1 and ' Date ' <= now ();
Modify an Event
Grammar:
ALTER EVENT Event_Name
[on SCHEDULE SCHEDULE]
[RENAME to New_event_name]
[on completion [NOT] PRESERVE]
[COMMENT ' COMMENT ']
[ENABLE | DISABLE]
[Do sql_statement]
Instance:
ALTER EVENT Updateinfostatus
On SCHEDULE EVERY MINUTE
Todo
UPDATE ' jd_article ' SET ' status ' = 0 WHERE ' status ' = 1 and ' Date ' <= now ();
Delete Event
DROP EVENTS IF EXISTS updateinfostatus
Temporary Shutdown Event
ALTER EVENTS Updateinfostatus DISABLE
Open Event
ALTER EVENTS Updateinfostatus ENABLE
View event Details
SELECT * from INFORMATION_SCHEMA. EVENTS WHERE event_name = ' updateinfostatus ' and Event_schema = ' JDWC '
View All Events
Show EVENTS
viewing event creation Information
Show CREATE EVENT Updateinfostatus
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.