Question

Managed MySQL database - Event Scheduler errors

Hi,

I have several managed MySQL databases and I have set up several event scheduler jobs for maintenance.

None of the scheduled events run correctly and I see errors in the “Logs & Queries” DigitalOcean dashboard, such as:

2022-06-15T16:00:00.146988Z 30638863 [ERROR] [MY-010045] [Server] Event Scheduler: [doadmin@%][packpilot.cleanup_disabled_trips3] 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 ‘“cleanup_disabled_trips3”() SQL SECURITY INVOKER delete from trip where enabled=’ at line 1

When I run the exact same Query statement when connected to the database, it runs correctly.

Here is the create event statement:

create event `cleanup_disabled_trips3` ON SCHEDULE EVERY 1 DAY STARTS '2022-06-15 16:00:00' DO 

delete from trip where enabled=0 and userID<>3 
AND (trip.lastupdate) < DATE_SUB(NOW(), INTERVAL 15 Day);

What I am doing wrong?


Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer