问题
I have a problem creating EVENT.
I have an 'articoli' table. There is a articoli.titolo field varchar (255) and when I try to create the event like this:
CREATE EVENT inser_value
ON SCHEDULE every 1 day
DO INSERT INTO articoli (titolo) VALUES ('my_value');
This is the mysqlerror's output
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use n ear 'EVENT inser_value ON SCHEDULE every 1 day DO INSERT INTO articoli (titolo) VALUE' at line 1
回答1:
This error appears if your MySQL version doesn't support the Event module, or if it's not started.
Please check those two.
This article talks about How to Configure MySQL Event Scheduler.
Starting MySQL’s Event Scheduler
MySQL events are executed by a special event scheduler thread. It’s disabled by default so use the following MySQL command can determine whether it’s running:
SHOW PROCESSLIST;
If the scheduler is running, at least two rows will be shown and one will have its user field set to event_scheduler
. If only one row is returned, the scheduler is disabled and events will not run.
You can ensure the scheduler starts when MySQL is launched with the command-line option --event-scheduler=ON
or setting event_scheduler=ON
in your MySQL configuration file (my.cnf or my.ini on Windows).
Alternatively, you can start the scheduler from the MySQL command line:
SET GLOBAL event_scheduler = ON;
来源:https://stackoverflow.com/questions/10853826/mysql-5-5-create-event-gives-syntax-error