Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getting error when creating EVENT in MySQL

Tags:

mysql

events

When i'm trying to create an EVENT in my MySQL getting this error

Script line: 1 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near

'EVENT `e_hourly`
ON SCHEDULE
  EVERY 1 HOUR
COMMENT 'Clears out s' at line 1

I'm attaching my create EVENT code here

CREATE EVENT `e_hourly`
  ON SCHEDULE
  EVERY 1 HOUR
  COMMENT 'Clears out sessions table each hour.'
  DO call testing();#here i'm trying to call a stored proc
like image 266
jay Avatar asked Nov 11 '22 11:11

jay


1 Answers

Your Event Code seems to be fine, perhaps you don't have support for events in your mysql version?

We usually format events as:

DELIMITER $$
DROP EVENT IF EXISTS E_Hourly$$
CREATE EVENT E_Hourly ON SCHEDULE EVERY 1 HOUR COMMENT 'Clears out sessions table each hour' DO
EV:BEGIN
  CALL Testing();
END$$
DELIMITER ;

SET GLOBAL event_scheduler = ON;
like image 117
jorese Avatar answered Nov 14 '22 22:11

jorese