<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h2 class="title">
      <a name="error-message-language">
      </a>
      12.12 Setting the Error Message Language
     </h2>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045215469824">
  </a>
  <a class="indexterm" name="idm46045215468368">
  </a>
  <a class="indexterm" name="idm46045215466880">
  </a>
  <a class="indexterm" name="idm46045215465392">
  </a>
  <p>
   By default,
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   produces error messages in
      English, but they can be displayed instead in any of several other
      languages: Czech, Danish, Dutch, Estonian, French, German, Greek,
      Hungarian, Italian, Japanese, Korean, Norwegian, Norwegian-ny,
      Polish, Portuguese, Romanian, Russian, Slovak, Spanish, or
      Swedish. This applies to messages the server writes to the error
      log and sends to clients.
  </p>
  <p>
   To select the language in which the server writes error messages,
      follow the instructions in this section. For information about
      changing the character set for error messages (rather than the
      language), see
   <a class="xref" href="charset-errors.html" title="12.6 Error Message Character Set">
    Section 12.6, “Error Message Character Set”
   </a>
   . For general
      information about configuring error logging, see
   <a class="xref" href="error-log.html" title="7.4.2 The Error Log">
    Section 7.4.2, “The Error Log”
   </a>
   .
  </p>
  <p>
   The server searches for the error message file using these rules:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      It looks for the file in a directory constructed from two
          system variable values,
      <a class="link" href="server-system-variables.html#sysvar_lc_messages_dir">
       <code class="literal">
        lc_messages_dir
       </code>
      </a>
      and
      <a class="link" href="server-system-variables.html#sysvar_lc_messages">
       <code class="literal">
        lc_messages
       </code>
      </a>
      , with the latter
          converted to a language name. Suppose that you start the
          server using this command:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa18031465"><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">mysqld <span class="token constant">--lc_messages_dir</span><span class="token attr-value"><span class="token punctuation">=</span>/usr/share/mysql</span> <span class="token constant">--lc_messages</span><span class="token attr-value"><span class="token punctuation">=</span>fr_FR</span></code></pre>
     </div>
     <p>
      In this case,
      <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
       <span class="command">
        <strong>
         mysqld
        </strong>
       </span>
      </a>
      maps the locale
      <code class="literal">
       fr_FR
      </code>
      to the language
      <code class="literal">
       french
      </code>
      and looks for the error file in the
      <code class="filename">
       /usr/share/mysql/french
      </code>
      directory.
     </p>
     <p>
      By default, the language files are located in the
      <code class="filename">
       share/mysql/
       <em class="replaceable">
        <code>
         LANGUAGE
        </code>
       </em>
      </code>
      directory under the MySQL base directory.
     </p>
    </li>
    <li class="listitem">
     <p>
      If the message file cannot be found in the directory
          constructed as just described, the server ignores the
      <a class="link" href="server-system-variables.html#sysvar_lc_messages">
       <code class="literal">
        lc_messages
       </code>
      </a>
      value and uses
          only the
      <a class="link" href="server-system-variables.html#sysvar_lc_messages_dir">
       <code class="literal">
        lc_messages_dir
       </code>
      </a>
      value as the location in which to look.
     </p>
    </li>
    <li class="listitem">
     <p>
      If the server cannot find the configured message file, it
          writes a message to the error log to indicate the problem and
          defaults to built-in English messages.
     </p>
    </li>
   </ul>
  </div>
  <p>
   The
   <a class="link" href="server-system-variables.html#sysvar_lc_messages_dir">
    <code class="literal">
     lc_messages_dir
    </code>
   </a>
   system
      variable can be set only at server startup and has only a global
      read-only value at runtime.
   <a class="link" href="server-system-variables.html#sysvar_lc_messages">
    <code class="literal">
     lc_messages
    </code>
   </a>
   can be set at server
      startup and has global and session values that can be modified at
      runtime. Thus, the error message language can be changed while the
      server is running, and each client can have its own error message
      language by setting its session
   <a class="link" href="server-system-variables.html#sysvar_lc_messages">
    <code class="literal">
     lc_messages
    </code>
   </a>
   value to the desired
      locale name. For example, if the server is using the
   <code class="literal">
    fr_FR
   </code>
   locale for error messages, a client can
      execute this statement to receive error messages in English:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa55759459"><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> lc_messages <span class="token operator">=</span> <span class="token string">'en_US'</span><span class="token punctuation">;</span></code></pre>
  </div>
 </div>
 <br/>
</div>
