If I'm making a connection to MySQL with serverTimezone=UTC
in my connection URL, will that change the @@session.time_zone
variable for my connection to MySQL? Or is the only way to alter @@session.time_zone
through issuing a SET time_zone...
statement? I was lead to believe that the combination of serverTimezone=UTC
and useLegacyDateTimeCode=false
would set the @@session.time_zone
to UTC (or whatever timezone I passed in as an argument to serverTimezone
) but testing this behaviour with MySQL Connector/J seems to indicate it does not.
1 Answers
Answers 1
If you want your MySQL to be configured UTC :
SET @@global.time_zone = '+00:00';
So every automatic update of datetime and everytime you connect to the database, @@session.time_zone will be set to @@global.time_zone.
Reboot and reconnection of the DB could be needed.
If you're just interested by the modification of the timezone of your session :
SET @@session.time_zone = '+00:00';
You need to do this after every connection.
0 comments:
Post a Comment