<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="replication-features-timezone">
      </a>
      19.5.1.33 Replication and Time Zones
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045135061856">
  </a>
  <a class="indexterm" name="idm46045135060368">
  </a>
  <p>
   By default, source and replica servers assume that they are in
        the same time zone. If you are replicating between servers in
        different time zones, the time zone must be set on both source
        and replica. Otherwise, statements depending on the local time
        on the source are not replicated properly, such as statements
        that use the
   <a class="link" href="date-and-time-functions.html#function_now">
    <code class="literal">
     NOW()
    </code>
   </a>
   or
   <a class="link" href="date-and-time-functions.html#function_from-unixtime">
    <code class="literal">
     FROM_UNIXTIME()
    </code>
   </a>
   functions.
  </p>
  <p>
   Verify that your combination of settings for the system time
        zone (
   <a class="link" href="server-system-variables.html#sysvar_system_time_zone">
    <code class="literal">
     system_time_zone
    </code>
   </a>
   ), server
        current time zone (the global value of
   <a class="link" href="server-system-variables.html#sysvar_time_zone">
    <code class="literal">
     time_zone
    </code>
   </a>
   ), and per-session
        time zones (the session value of
   <a class="link" href="server-system-variables.html#sysvar_time_zone">
    <code class="literal">
     time_zone
    </code>
   </a>
   ) on the source and
        replica is producing the correct results. In particular, if the
   <a class="link" href="server-system-variables.html#sysvar_time_zone">
    <code class="literal">
     time_zone
    </code>
   </a>
   system variable is
        set to the value
   <code class="literal">
    SYSTEM
   </code>
   , indicating that the
        server time zone is the same as the system time zone, this can
        cause the source and replica to apply different time zones. For
        example, a source could write the following statement in the
        binary log:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa67267700"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> <span class="token variable">@@session.time_zone</span><span class="token operator">=</span><span class="token string">'SYSTEM'</span><span class="token punctuation">;</span></code></pre>
  </div>
  <p>
   If this source and its replica have a different setting for
        their system time zones, this statement can produce unexpected
        results on the replica, even if the replica's global
   <a class="link" href="server-system-variables.html#sysvar_time_zone">
    <code class="literal">
     time_zone
    </code>
   </a>
   value has been set to
        match the source's. For an explanation of MySQL Server's time
        zone settings, and how to change them, see
   <a class="xref" href="time-zone-support.html" title="7.1.15 MySQL Server Time Zone Support">
    Section 7.1.15, “MySQL Server Time Zone Support”
   </a>
   .
  </p>
  <p>
   See also
   <a class="xref" href="replication-features-functions.html" title="19.5.1.14 Replication and System Functions">
    Section 19.5.1.14, “Replication and System Functions”
   </a>
   .
  </p>
 </div>
 <br/>
</div>
