Ever wanted to run queries in a cronjob? Where to safely put the database credentials? MySQL / MariaDB can help out with that.
You must have the
event_scheduler enabled, this can be done by running the following query:
It is highly recommended to use the config file(s) of your MySQL / MariaDB server to enable the
Another (hacky) way is to use the MySQL server
init_file option which runs a SQL script on server startup.
Create an Event to run a SQL Query¶
CREATE EVENT query below would run the query after the
DO every day at
02:00 in the
1 2 3 4 5 6 7 8 9 10
Show existing Events¶
exampledb is the database name.