<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h2 class="title">
      <a name="programs-development">
      </a>
      6.7 Program Development Utilities
     </h2>
    </div>
   </div>
  </div>
  <div class="toc">
   <dl class="toc">
    <dt>
     <span class="section">
      <a href="mysql-config.html">
       6.7.1 mysql_config — Display Options for Compiling Clients
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="my-print-defaults.html">
       6.7.2 my_print_defaults — Display Options from Option Files
      </a>
     </span>
    </dt>
   </dl>
  </div>
  <p>
   This section describes some utilities that you may find useful when
    developing MySQL programs.
  </p>
  <p>
   In shell scripts, you can use the
   <a class="link" href="my-print-defaults.html" title="6.7.2 my_print_defaults — Display Options from Option Files">
    <span class="command">
     <strong>
      my_print_defaults
     </strong>
    </span>
   </a>
   program to parse option files
    and see what options would be used by a given program. The following
    example shows the output that
   <a class="link" href="my-print-defaults.html" title="6.7.2 my_print_defaults — Display Options from Option Files">
    <span class="command">
     <strong>
      my_print_defaults
     </strong>
    </span>
   </a>
   might produce when asked to show the options found in the
   <code class="literal">
    [client]
   </code>
   and
   <code class="literal">
    [mysql]
   </code>
   groups:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa34582114"><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">my_print_defaults</span> client mysql
<span class="token constant">--port</span><span class="token attr-value"><span class="token punctuation">=</span>3306</span>
<span class="token constant">--socket</span><span class="token attr-value"><span class="token punctuation">=</span>/tmp/mysql.sock</span>
<span class="token property">--no-auto-rehash</span></code></pre>
  </div>
  <p>
   Note for developers: Option file handling is implemented in the C
    client library simply by processing all options in the appropriate
    group or groups before any command-line arguments. This works well
    for programs that use the last instance of an option that is
    specified multiple times. If you have a C or C++ program that
    handles multiply specified options this way but that doesn't read
    option files, you need add only two lines to give it that
    capability. Check the source code of any of the standard MySQL
    clients to see how to do this.
  </p>
  <p>
   Several other language interfaces to MySQL are based on the C client
    library, and some of them provide a way to access option file
    contents. These include Perl and Python. For details, see the
    documentation for your preferred interface.
  </p>
 </div>
 <br/>
</div>
