mysqlgoogle-cloud-platformgoogle-cloud-sqlmysql-5.7mysql-event

How to enable Mysql Event Scheduler in Google Cloud SQL?


I have a somewhat restricted access to a Mysql instance in Google Cloud. There, I need to run two scheduled events (call a procedure) every few minutes and once a day at a fixed time. However, I am unable to enable the event scheduler, nor could the instance owner. Can anyone please guide me to effectively enable the event scheduler? Or, is there any other way around this from within the DBMS?

SHOW VARIABLES where Variable_name like '%sched%';

shows |event_scheduler|OFF| |:-------------:|:-:|

When the instance owner tries to turn it ON,

SET GLOBAL event_scheduler = ON;

says SQL Error [1227] [42000]: Access denied; you need (at least one of) the SUPER privilege(s) for this operation

Mysql version 5.7


Solution

  • MySQL operations that require Super privileges are not supported under Cloud SQL. Check this documented in Cloud SQL FAQ.
    As an alternative way, you can enable the Event Scheduler via your Google Cloud Platform Console.
    Please go to your Cloud Console > SQL > Choose your SQL instance > Instance details: Edit> Flags> Add Flag> Choose event_scheduler > On > Save.
    For more information and options about setting database flags in MySQL,check Setting Database flag document.

    Also , you could use the cron service from App Engine to trigger the stored procedures through setting up and configuring your App Engine environment.