5

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

1 Answer 1

1

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;
Sign up to request clarification or add additional context in comments.

1 Comment

i've tried your code but still get error... and my MySQL server version is 5.0.41.. is the version is villain here..? and one more thing when i've tried to "SET GLOBAL event_scheduler = 1" i got error "Unknown system variable event_scheduler"(i'm sharing this information cause i think it may helps)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.