How to make an event execute in MySQL

I am trying to write an automated test script to test the MySQL event I created, and I am wondering if there is a way to execute some kind of command to force the event to execute. The event is set up to run daily at midnight, but I don't want the automated test script to have to wait for the event to fire.

One of the ways I can think of is ALTER Event, so that it will execute one-time 5 seconds in the future, but I would like to know if there is a more elegant way to make it execute.

+6
mysql
source share
2 answers
  • Move all code inside an event to a stored procedure
  • Make an event only a stored procedure call
  • Check the stored procedure with the CALL syntax.
+14
source share

if it is based on system time, change this and see if your event fires, and then change the system time back.

0
source share

All Articles