<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="making-trace-files">
      </a>
      7.9.1.2 Creating Trace Files
     </h4>
    </div>
   </div>
  </div>
  <p>
   If the
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   server does not start or it
        crashes easily, you can try to create a trace file to find the
        problem.
  </p>
  <p>
   To do this, you must have a
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   that has
        been compiled with debugging support. You can check this by
        executing
   <code class="literal">
    mysqld -V
   </code>
   . If the version number
        ends with
   <code class="literal">
    -debug
   </code>
   , it is compiled with support
        for trace files. (On Windows, the debugging server is named
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld-debug
     </strong>
    </span>
   </a>
   rather than
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   .)
  </p>
  <p>
   Start the
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   server with a trace log in
   <code class="filename">
    /tmp/mysqld.trace
   </code>
   on Unix or
   <code class="filename">
    \mysqld.trace
   </code>
   on Windows:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa84477620"><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">--debug</span></code></pre>
  </div>
  <p>
   On Windows, you should also use the
   <a class="link" href="server-options.html#option_mysqld_standalone">
    <code class="option">
     --standalone
    </code>
   </a>
   flag to not start
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   as a service. In a console window, use
        this command:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa89452025"><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">C:\&gt;</span><span class="token command"> mysqld-debug</span> <span class="token property">--debug</span> <span class="token property">--standalone</span></code></pre>
  </div>
  <p>
   After this, you can use the
   <code class="literal">
    mysql.exe
   </code>
   command-line tool in a second console window to reproduce the
        problem. You can stop the
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   server with
   <a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
    <span class="command">
     <strong>
      mysqladmin shutdown
     </strong>
    </span>
   </a>
   .
  </p>
  <p>
   The trace file can become
   <span class="bold">
    <strong>
     very
        large
    </strong>
   </span>
   ! To generate a smaller trace file, you can use
        debugging options something like this:
  </p>
  <p>
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
        --debug=d,info,error,query,general,where:O,/tmp/mysqld.trace
     </strong>
    </span>
   </a>
  </p>
  <p>
   This only prints information with the most interesting tags to
        the trace file.
  </p>
  <p>
   If you file a bug, please add only those lines from the trace
        file to the bug report that indicate where something seems to go
        wrong. If you cannot locate the wrong place, open a bug report
        and upload the whole trace file to the report, so that a MySQL
        developer can take a look at it. For instructions, see
   <a class="xref" href="bug-reports.html" title="1.6 How to Report Bugs or Problems">
    Section 1.6, “How to Report Bugs or Problems”
   </a>
   .
  </p>
  <p>
   The trace file is made with the
   <code class="literal">
    DBUG
   </code>
   package
        by Fred Fish. See
   <a class="xref" href="dbug-package.html" title="7.9.4 The DBUG Package">
    Section 7.9.4, “The DBUG Package”
   </a>
   .
  </p>
 </div>
 <br/>
</div>
