<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="mysql-tzinfo-to-sql">
      </a>
      6.4.3 mysql_tzinfo_to_sql — Load the Time Zone Tables
     </h3>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045320220784">
  </a>
  <a class="indexterm" name="idm46045320219872">
  </a>
  <p>
   The
   <a class="link" href="mysql-tzinfo-to-sql.html" title="6.4.3 mysql_tzinfo_to_sql — Load the Time Zone Tables">
    <span class="command">
     <strong>
      mysql_tzinfo_to_sql
     </strong>
    </span>
   </a>
   program loads the
        time zone tables in the
   <code class="literal">
    mysql
   </code>
   database. It is
        used on systems that have a
   <span class="firstterm">
    zoneinfo
   </span>
   database (the set
        of files describing time zones). Examples of such systems are
        Linux, FreeBSD, Solaris, and macOS. One likely location for
        these files is the
   <code class="filename">
    /usr/share/zoneinfo
   </code>
   directory (
   <code class="filename">
    /usr/share/lib/zoneinfo
   </code>
   on
        Solaris). If your system does not have a zoneinfo database, you
        can use the downloadable package described in
   <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>
   <a class="link" href="mysql-tzinfo-to-sql.html" title="6.4.3 mysql_tzinfo_to_sql — Load the Time Zone Tables">
    <span class="command">
     <strong>
      mysql_tzinfo_to_sql
     </strong>
    </span>
   </a>
   can be invoked several
        ways:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa32541407"><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-terminal">mysql_tzinfo_to_sql <em class="replaceable">tz_dir</em>
mysql_tzinfo_to_sql <em class="replaceable">tz_file tz_name</em>
mysql_tzinfo_to_sql <span class="token property">--leap</span> <em class="replaceable">tz_file</em></code></pre>
  </div>
  <p>
   For the first invocation syntax, pass the zoneinfo directory
        path name to
   <a class="link" href="mysql-tzinfo-to-sql.html" title="6.4.3 mysql_tzinfo_to_sql — Load the Time Zone Tables">
    <span class="command">
     <strong>
      mysql_tzinfo_to_sql
     </strong>
    </span>
   </a>
   and send the
        output into the
   <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
    <span class="command">
     <strong>
      mysql
     </strong>
    </span>
   </a>
   program. For example:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa41397936"><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-terminal">mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql <span class="token property">-u</span> root mysql</code></pre>
  </div>
  <p>
   <a class="link" href="mysql-tzinfo-to-sql.html" title="6.4.3 mysql_tzinfo_to_sql — Load the Time Zone Tables">
    <span class="command">
     <strong>
      mysql_tzinfo_to_sql
     </strong>
    </span>
   </a>
   reads your system's time
        zone files and generates SQL statements from them.
   <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
    <span class="command">
     <strong>
      mysql
     </strong>
    </span>
   </a>
   processes those statements to load the
        time zone tables.
  </p>
  <p>
   The second syntax causes
   <a class="link" href="mysql-tzinfo-to-sql.html" title="6.4.3 mysql_tzinfo_to_sql — Load the Time Zone Tables">
    <span class="command">
     <strong>
      mysql_tzinfo_to_sql
     </strong>
    </span>
   </a>
   to load a single time zone file
   <em class="replaceable">
    <code>
     tz_file
    </code>
   </em>
   that corresponds to a time
        zone name
   <em class="replaceable">
    <code>
     tz_name
    </code>
   </em>
   :
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa32285612"><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-terminal">mysql_tzinfo_to_sql <em class="replaceable">tz_file</em> <em class="replaceable">tz_name</em> | mysql <span class="token property">-u</span> root mysql</code></pre>
  </div>
  <p>
   If your time zone needs to account for leap seconds, invoke
   <a class="link" href="mysql-tzinfo-to-sql.html" title="6.4.3 mysql_tzinfo_to_sql — Load the Time Zone Tables">
    <span class="command">
     <strong>
      mysql_tzinfo_to_sql
     </strong>
    </span>
   </a>
   using the third syntax,
        which initializes the leap second information.
   <em class="replaceable">
    <code>
     tz_file
    </code>
   </em>
   is the name of your time zone
        file:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa90522193"><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-terminal">mysql_tzinfo_to_sql <span class="token property">--leap</span> <em class="replaceable">tz_file</em> | mysql <span class="token property">-u</span> root mysql</code></pre>
  </div>
  <p>
   After running
   <a class="link" href="mysql-tzinfo-to-sql.html" title="6.4.3 mysql_tzinfo_to_sql — Load the Time Zone Tables">
    <span class="command">
     <strong>
      mysql_tzinfo_to_sql
     </strong>
    </span>
   </a>
   , it is best
        to restart the server so that it does not continue to use any
        previously cached time zone data.
  </p>
 </div>
 <br/>
</div>
