<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="mysql-config">
      </a>
      6.7.1 mysql_config — Display Options for Compiling Clients
     </h3>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045303064400">
  </a>
  <a class="indexterm" name="idm46045303063488">
  </a>
  <p>
   <a class="link" href="mysql-config.html" title="6.7.1 mysql_config — Display Options for Compiling Clients">
    <span class="command">
     <strong>
      mysql_config
     </strong>
    </span>
   </a>
   provides you with useful
        information for compiling your MySQL client and connecting it to
        MySQL. It is a shell script, so it is available only on Unix and
        Unix-like systems.
  </p>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    <span class="command">
     <strong>
      pkg-config
     </strong>
    </span>
    can be used as an alternative to
    <a class="link" href="mysql-config.html" title="6.7.1 mysql_config — Display Options for Compiling Clients">
     <span class="command">
      <strong>
       mysql_config
      </strong>
     </span>
    </a>
    for obtaining information such
          as compiler flags or link libraries required to compile MySQL
          applications. For more information, see
    <a class="ulink" href="/doc/c-api/8.4/en/c-api-building-clients-pkg-config.html" target="_top">
     Building C API Client Programs Using pkg-config
    </a>
    .
   </p>
  </div>
  <p>
   <a class="link" href="mysql-config.html" title="6.7.1 mysql_config — Display Options for Compiling Clients">
    <span class="command">
     <strong>
      mysql_config
     </strong>
    </span>
   </a>
   supports the following options.
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a name="option_mysql_config_cflags">
      </a>
      <a class="link" href="mysql-config.html#option_mysql_config_cflags">
       <code class="option">
        --cflags
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045303052896">
     </a>
     <a class="indexterm" name="idm46045303051408">
     </a>
     <p>
      C Compiler flags to find include files and critical compiler
            flags and defines used when compiling the
      <code class="literal">
       libmysqlclient
      </code>
      library. The options
            returned are tied to the specific compiler that was used
            when the library was created and might clash with the
            settings for your own compiler. Use
      <a class="link" href="mysql-config.html#option_mysql_config_include">
       <code class="option">
        --include
       </code>
      </a>
      for more
            portable options that contain only include paths.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_mysql_config_cxxflags">
      </a>
      <a class="link" href="mysql-config.html#option_mysql_config_cxxflags">
       <code class="option">
        --cxxflags
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045303045024">
     </a>
     <a class="indexterm" name="idm46045303043536">
     </a>
     <p>
      Like
      <a class="link" href="mysql-config.html#option_mysql_config_cflags">
       <code class="option">
        --cflags
       </code>
      </a>
      , but for
            C++ compiler flags.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_mysql_config_include">
      </a>
      <a class="link" href="mysql-config.html#option_mysql_config_include">
       <code class="option">
        --include
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045303038480">
     </a>
     <a class="indexterm" name="idm46045303036992">
     </a>
     <p>
      Compiler options to find MySQL include files.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_mysql_config_libs">
      </a>
      <a class="link" href="mysql-config.html#option_mysql_config_libs">
       <code class="option">
        --libs
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045303032736">
     </a>
     <a class="indexterm" name="idm46045303031248">
     </a>
     <p>
      Libraries and options required to link with the MySQL client
            library.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_mysql_config_libs_r">
      </a>
      <a class="link" href="mysql-config.html#option_mysql_config_libs_r">
       <code class="option">
        --libs_r
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045303026880">
     </a>
     <a class="indexterm" name="idm46045303025392">
     </a>
     <p>
      Libraries and options required to link with the thread-safe
            MySQL client library. In MySQL 8.4, all client
            libraries are thread-safe, so this option need not be used.
            The
      <a class="link" href="mysql-config.html#option_mysql_config_libs">
       <code class="option">
        --libs
       </code>
      </a>
      option can
            be used in all cases.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_mysql_config_plugindir">
      </a>
      <a class="link" href="mysql-config.html#option_mysql_config_plugindir">
       <code class="option">
        --plugindir
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045303019872">
     </a>
     <a class="indexterm" name="idm46045303018384">
     </a>
     <p>
      The default plugin directory path name, defined when
            configuring MySQL.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_mysql_config_port">
      </a>
      <a class="link" href="mysql-config.html#option_mysql_config_port">
       <code class="option">
        --port
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045303014128">
     </a>
     <a class="indexterm" name="idm46045303012640">
     </a>
     <a class="indexterm" name="idm46045303011152">
     </a>
     <p>
      The default TCP/IP port number, defined when configuring
            MySQL.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_mysql_config_socket">
      </a>
      <a class="link" href="mysql-config.html#option_mysql_config_socket">
       <code class="option">
        --socket
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045303007216">
     </a>
     <a class="indexterm" name="idm46045303005728">
     </a>
     <p>
      The default Unix socket file, defined when configuring
            MySQL.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_mysql_config_variable">
      </a>
      <a class="link" href="mysql-config.html#option_mysql_config_variable">
       <code class="option">
        --variable=
        <em class="replaceable">
         <code>
          var_name
         </code>
        </em>
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045303001216">
     </a>
     <a class="indexterm" name="idm46045302999728">
     </a>
     <p>
      Display the value of the named configuration variable.
            Permitted
      <em class="replaceable">
       <code>
        var_name
       </code>
      </em>
      values are
      <code class="literal">
       pkgincludedir
      </code>
      (the header file
            directory),
      <code class="literal">
       pkglibdir
      </code>
      (the library
            directory), and
      <code class="literal">
       plugindir
      </code>
      (the plugin
            directory).
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_mysql_config_version">
      </a>
      <a class="link" href="mysql-config.html#option_mysql_config_version">
       <code class="option">
        --version
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045302992720">
     </a>
     <a class="indexterm" name="idm46045302991232">
     </a>
     <p>
      Version number for the MySQL distribution.
     </p>
    </li>
   </ul>
  </div>
  <p>
   If you invoke
   <a class="link" href="mysql-config.html" title="6.7.1 mysql_config — Display Options for Compiling Clients">
    <span class="command">
     <strong>
      mysql_config
     </strong>
    </span>
   </a>
   with no options,
        it displays a list of all options that it supports, and their
        values:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa82131391"><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">mysql_config</span>
Usage<span class="token punctuation">:</span> <span class="token punctuation">.</span>/mysql_config <span class="token property"><span class="token punctuation">[</span>OPTIONS<span class="token punctuation">]</span></span>
Compiler<span class="token punctuation">:</span> GNU 10<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0

Options<span class="token punctuation">:</span>
  <span class="token property">--cflags</span>         <span class="token punctuation">[</span><span class="token property">-I/usr/local/mysql/include/mysql</span><span class="token punctuation">]</span>
  <span class="token property">--cxxflags</span>       <span class="token punctuation">[</span><span class="token property">-I/usr/local/mysql/include/mysql</span><span class="token punctuation">]</span>
  <span class="token property">--include</span>        <span class="token punctuation">[</span><span class="token property">-I/usr/local/mysql/include/mysql</span><span class="token punctuation">]</span>
  <span class="token property">--libs</span>           <span class="token punctuation">[</span><span class="token property">-L/usr/local/mysql/lib/mysql</span> <span class="token property">-lmysqlclient</span> <span class="token property">-lpthread</span> <span class="token property">-ldl</span>  
                    <span class="token property">-lssl</span>  <span class="token property">-lcrypto</span> <span class="token property">-lresolv</span> <span class="token property">-lm</span> <span class="token property">-lrt</span><span class="token punctuation">]</span>
  <span class="token property">--libs_r</span>         <span class="token punctuation">[</span><span class="token property">-L/usr/local/mysql/lib/mysql</span> <span class="token property">-lmysqlclient</span> <span class="token property">-lpthread</span> <span class="token property">-ldl</span>  
                    <span class="token property">-lssl</span>  <span class="token property">-lcrypto</span> <span class="token property">-lresolv</span> <span class="token property">-lm</span> <span class="token property">-lrt</span><span class="token punctuation">]</span>
  <span class="token property">--plugindir</span>      <span class="token punctuation">[</span>/usr/local/mysql/lib/plugin<span class="token punctuation">]</span>
  <span class="token property">--socket</span>         <span class="token punctuation">[</span>/tmp/mysql<span class="token punctuation">.</span>sock<span class="token punctuation">]</span>
  <span class="token property">--port</span>           <span class="token punctuation">[</span>3306<span class="token punctuation">]</span>
  <span class="token property">--version</span>        <span class="token punctuation">[</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token punctuation">]</span>
  <span class="token constant">--variable</span><span class="token attr-value"><span class="token punctuation">=</span>VAR</span>   VAR is one of<span class="token punctuation">:</span>
          pkgincludedir <span class="token punctuation">[</span>/usr/local/mysql/include<span class="token punctuation">]</span>
          pkglibdir     <span class="token punctuation">[</span>/usr/local/mysql/lib<span class="token punctuation">]</span>
          plugindir     <span class="token punctuation">[</span>/usr/local/mysql/lib/plugin<span class="token punctuation">]</span></code></pre>
  </div>
  <p>
   You can use
   <a class="link" href="mysql-config.html" title="6.7.1 mysql_config — Display Options for Compiling Clients">
    <span class="command">
     <strong>
      mysql_config
     </strong>
    </span>
   </a>
   within a command
        line using backticks to include the output that it produces for
        particular options. For example, to compile and link a MySQL
        client program, use
   <a class="link" href="mysql-config.html" title="6.7.1 mysql_config — Display Options for Compiling Clients">
    <span class="command">
     <strong>
      mysql_config
     </strong>
    </span>
   </a>
   as follows:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa97222803"><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">gcc <span class="token property">-c</span> `mysql_config <span class="token property">--cflags`</span> progname<span class="token punctuation">.</span>c
gcc <span class="token property">-o</span> progname progname<span class="token punctuation">.</span>o `mysql_config <span class="token property">--libs`</span></code></pre>
  </div>
 </div>
 <br/>
</div>
