mysqltimestamptimezonemysql-event

MySQL event time scheduled one hour less than CURRENT_TIMESTAMP


I'm trying to schedule a MySQL EVENT with the following instructions:

CREATE EVENT IF NOT EXISTS test_event
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 MINUTE

but the event is scheduled one hour less than CURRENT_TIMESTAMP.

The command:

SELECT @@GLOBAL.time_zone, @@SESSION.time_zone, CURRENT_TIMESTAMP;

returns to me:

'SYSTEM', 'SYSTEM', '2020-03-19 17:01:38'

and

SHOW EVENTS;

returns to me:

|    Db   |    Name   | Definer | Time zone |   Type   |      Execute at     |  Status | Originator |
| test_db | test_vent | user@%  |  +00:00   | ONE TIME | 2020-03-19 16:02:38 | ENABLED |     1      |

The MySQL server is running on my laptop and the system timezone of my laptop is UTC+1

I've noted the TIME zone +00:00 in SHOW EVENTS but I've no settings of timezones in my.ini

Can someone help me to better understand this misalignment ?

Thank you


Solution

  • I found the problem in my script. At the beginning of the script I found a command to set the time zone:

    /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE /; /!40103 SET TIME_ZONE='+00:00' */;

    and this created the problem.