skip to Main Content

Our local clocks just went forward for daylight saving’s time, and as usual our database server is an hour off again. Is it possible to configure my.cnf to simply inherit the timezone offset from Cent OS or are we destined to have to change it manually every six months?

2

Answers


  1. Chosen as BEST ANSWER

    The answer seems to be to add a hash before default-time-zone from /etc/my.cnf to disable it, then restart MySQL.

    As the manual describes, MySQL will default to system_time_zone if the default is not explicitly set.

    If this option is not given, the default time zone is the same as the system time zone (given by the value of the system_time_zone system variable.


  2. My answer got converted to comment for some reason because it was short.

    Your database is most likely set to the same timezone as the server. The issue is the following:

    Neither the DATETIME nor the TIMESTAMP field types can accurately
    store data in a timezone that observes DST. If you store “2009-11-01
    01:30:00” the fields have no way to distinguish which version of
    1:30am you wanted — the -04:00 or -05:00 version.

    For a detailed answer take a look here: https://stackoverflow.com/a/1650910/11291413

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search