<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="server-configuration-validation">
      </a>
      7.1.3 Server Configuration Validation
     </h3>
    </div>
   </div>
  </div>
  <p>
   MySQL supports a
   <a class="link" href="server-options.html#option_mysqld_validate-config">
    <code class="option">
     --validate-config
    </code>
   </a>
   option that enables the startup configuration to be checked for
      problems without running the server in normal operational mode:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa69973757"><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 property">--validate-config</span></code></pre>
  </div>
  <p>
   If no errors are found, the server terminates with an exit code of
      0. If an error is found, the server displays a diagnostic message
      and terminates with an exit code of 1. For example:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa75799516"><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"><span class="token prompt">$&gt; </span><span class="token command">mysqld</span> <span class="token property">--validate-config</span> <span class="token property">--no-such-option</span>
2018-11-05T17<span class="token punctuation">:</span>50<span class="token punctuation">:</span>12<span class="token punctuation">.</span>738919Z 0 <span class="token property"><span class="token punctuation">[</span>ERROR<span class="token punctuation">]</span></span> <span class="token punctuation">[</span>MY-000068<span class="token punctuation">]</span> <span class="token punctuation">[</span>Server<span class="token punctuation">]</span> unknown
option <span class="token atrule">'--no-such-option'</span><span class="token punctuation">.</span>
2018-11-05T17<span class="token punctuation">:</span>50<span class="token punctuation">:</span>12<span class="token punctuation">.</span>738962Z 0 <span class="token property"><span class="token punctuation">[</span>ERROR<span class="token punctuation">]</span></span> <span class="token punctuation">[</span>MY-010119<span class="token punctuation">]</span> <span class="token punctuation">[</span>Server<span class="token punctuation">]</span> Aborting</code></pre>
  </div>
  <p>
   The server terminates as soon as any error is found. For
      additional checks to occur, correct the initial problem and run
      the server with
   <a class="link" href="server-options.html#option_mysqld_validate-config">
    <code class="option">
     --validate-config
    </code>
   </a>
   again.
  </p>
  <p>
   For the preceding example, where use of
   <a class="link" href="server-options.html#option_mysqld_validate-config">
    <code class="option">
     --validate-config
    </code>
   </a>
   results in
      display of an error message, the server exit code is 1. Warning
      and information messages may also be displayed, depending on the
   <a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
    <code class="literal">
     log_error_verbosity
    </code>
   </a>
   value, but do
      not produce immediate validation termination or an exit code of 1.
      For example, this command produces multiple warnings, both of
      which are displayed. But no error occurs, so the exit code is 0:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa36147251"><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"><span class="token prompt">$&gt; </span><span class="token command">mysqld</span> <span class="token property">--validate-config</span> <span class="token constant">--log_error_verbosity</span><span class="token attr-value"><span class="token punctuation">=</span>2</span>
         <span class="token constant">--read-only</span><span class="token attr-value"><span class="token punctuation">=</span>s</span> <span class="token constant">--transaction_read_only</span><span class="token attr-value"><span class="token punctuation">=</span>s</span>
2018-11-05T15<span class="token punctuation">:</span>43<span class="token punctuation">:</span>18<span class="token punctuation">.</span>445863Z 0 <span class="token punctuation">[</span>Warning<span class="token punctuation">]</span> <span class="token punctuation">[</span>MY-000076<span class="token punctuation">]</span> <span class="token punctuation">[</span>Server<span class="token punctuation">]</span> option
<span class="token atrule">'read_only'</span><span class="token punctuation">:</span> boolean value <span class="token atrule">'s'</span> was not recognized<span class="token punctuation">.</span> Set to OFF<span class="token punctuation">.</span>
2018-11-05T15<span class="token punctuation">:</span>43<span class="token punctuation">:</span>18<span class="token punctuation">.</span>445882Z 0 <span class="token punctuation">[</span>Warning<span class="token punctuation">]</span> <span class="token punctuation">[</span>MY-000076<span class="token punctuation">]</span> <span class="token punctuation">[</span>Server<span class="token punctuation">]</span> option
<span class="token atrule">'transaction-read-only'</span><span class="token punctuation">:</span> boolean value <span class="token atrule">'s'</span> was not recognized<span class="token punctuation">.</span> Set to OFF<span class="token punctuation">.</span></code></pre>
  </div>
  <p>
   This command produces the same warnings, but also an error, so the
      error message is displayed along with the warnings and the exit
      code is 1:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa41032362"><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"><span class="token prompt">$&gt; </span><span class="token command">mysqld</span> <span class="token property">--validate-config</span> <span class="token constant">--log_error_verbosity</span><span class="token attr-value"><span class="token punctuation">=</span>2</span>
         <span class="token property">--no-such-option</span> <span class="token constant">--read-only</span><span class="token attr-value"><span class="token punctuation">=</span>s</span> <span class="token constant">--transaction_read_only</span><span class="token attr-value"><span class="token punctuation">=</span>s</span>
2018-11-05T15<span class="token punctuation">:</span>43<span class="token punctuation">:</span>53<span class="token punctuation">.</span>152886Z 0 <span class="token punctuation">[</span>Warning<span class="token punctuation">]</span> <span class="token punctuation">[</span>MY-000076<span class="token punctuation">]</span> <span class="token punctuation">[</span>Server<span class="token punctuation">]</span> option
<span class="token atrule">'read_only'</span><span class="token punctuation">:</span> boolean value <span class="token atrule">'s'</span> was not recognized<span class="token punctuation">.</span> Set to OFF<span class="token punctuation">.</span>
2018-11-05T15<span class="token punctuation">:</span>43<span class="token punctuation">:</span>53<span class="token punctuation">.</span>152913Z 0 <span class="token punctuation">[</span>Warning<span class="token punctuation">]</span> <span class="token punctuation">[</span>MY-000076<span class="token punctuation">]</span> <span class="token punctuation">[</span>Server<span class="token punctuation">]</span> option
<span class="token atrule">'transaction-read-only'</span><span class="token punctuation">:</span> boolean value <span class="token atrule">'s'</span> was not recognized<span class="token punctuation">.</span> Set to OFF<span class="token punctuation">.</span>
2018-11-05T15<span class="token punctuation">:</span>43<span class="token punctuation">:</span>53<span class="token punctuation">.</span>164889Z 0 <span class="token property"><span class="token punctuation">[</span>ERROR<span class="token punctuation">]</span></span> <span class="token punctuation">[</span>MY-000068<span class="token punctuation">]</span> <span class="token punctuation">[</span>Server<span class="token punctuation">]</span> unknown
option <span class="token atrule">'--no-such-option'</span><span class="token punctuation">.</span>
2018-11-05T15<span class="token punctuation">:</span>43<span class="token punctuation">:</span>53<span class="token punctuation">.</span>165053Z 0 <span class="token property"><span class="token punctuation">[</span>ERROR<span class="token punctuation">]</span></span> <span class="token punctuation">[</span>MY-010119<span class="token punctuation">]</span> <span class="token punctuation">[</span>Server<span class="token punctuation">]</span> Aborting</code></pre>
  </div>
  <p>
   The scope of the
   <a class="link" href="server-options.html#option_mysqld_validate-config">
    <code class="option">
     --validate-config
    </code>
   </a>
   option is limited to configuration checking that the server can
      perform without undergoing its normal startup process. As such,
      the configuration check does not initialize storage engines and
      other plugins, components, and so forth, and does not validate
      options associated with those uninitialized subsystems.
  </p>
  <p>
   <a class="link" href="server-options.html#option_mysqld_validate-config">
    <code class="option">
     --validate-config
    </code>
   </a>
   can be used any
      time, but is particularly useful after an upgrade, to check
      whether any options previously used with the older server are
      considered by the upgraded server to be deprecated or obsolete.
      For example, the
   <code class="literal">
    tx_read_only
   </code>
   system variable
      was removed in 8.0. Suppose that a MySQL 5.7 server was run using
      that system variable in its
   <code class="filename">
    my.cnf
   </code>
   file and
      then upgraded to MySQL 8.4. Running the upgraded
      server with
   <a class="link" href="server-options.html#option_mysqld_validate-config">
    <code class="option">
     --validate-config
    </code>
   </a>
   to
      check the configuration produces this result:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa15889921"><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"><span class="token prompt">$&gt; </span><span class="token command">mysqld</span> <span class="token property">--validate-config</span>
2018-11-05T10<span class="token punctuation">:</span>40<span class="token punctuation">:</span>02<span class="token punctuation">.</span>712141Z 0 <span class="token property"><span class="token punctuation">[</span>ERROR<span class="token punctuation">]</span></span> <span class="token punctuation">[</span>MY-000067<span class="token punctuation">]</span> <span class="token punctuation">[</span>Server<span class="token punctuation">]</span> unknown variable
<span class="token atrule">'tx_read_only=ON'</span><span class="token punctuation">.</span>
2018-11-05T10<span class="token punctuation">:</span>40<span class="token punctuation">:</span>02<span class="token punctuation">.</span>712178Z 0 <span class="token property"><span class="token punctuation">[</span>ERROR<span class="token punctuation">]</span></span> <span class="token punctuation">[</span>MY-010119<span class="token punctuation">]</span> <span class="token punctuation">[</span>Server<span class="token punctuation">]</span> Aborting</code></pre>
  </div>
  <p>
   <a class="link" href="server-options.html#option_mysqld_validate-config">
    <code class="option">
     --validate-config
    </code>
   </a>
   can be used with
      the
   <a class="link" href="option-file-options.html#option_general_defaults-file">
    <code class="option">
     --defaults-file
    </code>
   </a>
   option to
      validate only the options in a specific file:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa14623707"><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"><span class="token prompt">$&gt; </span><span class="token command">mysqld</span> <span class="token constant">--defaults-file</span><span class="token attr-value"><span class="token punctuation">=</span>./my.cnf-test</span> <span class="token property">--validate-config</span>
2018-11-05T10<span class="token punctuation">:</span>40<span class="token punctuation">:</span>02<span class="token punctuation">.</span>712141Z 0 <span class="token property"><span class="token punctuation">[</span>ERROR<span class="token punctuation">]</span></span> <span class="token punctuation">[</span>MY-000067<span class="token punctuation">]</span> <span class="token punctuation">[</span>Server<span class="token punctuation">]</span> unknown variable
<span class="token atrule">'tx_read_only=ON'</span><span class="token punctuation">.</span>
2018-11-05T10<span class="token punctuation">:</span>40<span class="token punctuation">:</span>02<span class="token punctuation">.</span>712178Z 0 <span class="token property"><span class="token punctuation">[</span>ERROR<span class="token punctuation">]</span></span> <span class="token punctuation">[</span>MY-010119<span class="token punctuation">]</span> <span class="token punctuation">[</span>Server<span class="token punctuation">]</span> Aborting</code></pre>
  </div>
  <p>
   Remember that
   <a class="link" href="option-file-options.html#option_general_defaults-file">
    <code class="option">
     --defaults-file
    </code>
   </a>
   , if
      specified, must be the first option on the command line.
      (Executing the preceding example with the option order reversed
      produces a message that
   <a class="link" href="option-file-options.html#option_general_defaults-file">
    <code class="option">
     --defaults-file
    </code>
   </a>
   itself is
      unknown.)
  </p>
 </div>
 <br/>
</div>
