<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h2 class="title">
      <a name="using-mysqldump">
      </a>
      9.4 Using mysqldump for Backups
     </h2>
    </div>
   </div>
  </div>
  <div class="toc">
   <dl class="toc">
    <dt>
     <span class="section">
      <a href="mysqldump-sql-format.html">
       9.4.1 Dumping Data in SQL Format with mysqldump
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="reloading-sql-format-dumps.html">
       9.4.2 Reloading SQL-Format Backups
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="mysqldump-delimited-text.html">
       9.4.3 Dumping Data in Delimited-Text Format with mysqldump
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="reloading-delimited-text-dumps.html">
       9.4.4 Reloading Delimited-Text Format Backups
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="mysqldump-tips.html">
       9.4.5 mysqldump Tips
      </a>
     </span>
    </dt>
   </dl>
  </div>
  <a class="indexterm" name="idm46045231112928">
  </a>
  <a class="indexterm" name="idm46045231111472">
  </a>
  <div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Tip
   </div>
   <p>
    Consider using the
    <a class="ulink" href="/doc/mysql-shell/8.4/en/mysql-shell-utilities-dump-instance-schema.html" target="_top">
     MySQL Shell dump utilities
    </a>
    , which provide parallel dumping with multiple threads, file compression, and progress information display, as well as cloud features such as Oracle Cloud Infrastructure Object Storage streaming, and MySQL HeatWave Service compatibility checks and modifications. Dumps can be easily imported into a MySQL Server instance or a MySQL HeatWave Service DB System using the
    <a class="ulink" href="/doc/mysql-shell/8.4/en/mysql-shell-utilities-load-dump.html" target="_top">
     MySQL Shell load dump utilities
    </a>
    . Installation instructions for MySQL Shell can be found
    <a class="ulink" href="/doc/mysql-shell/8.4/en/mysql-shell-install.html" target="_top">
     here
    </a>
    .
   </p>
  </div>
  <p>
   This section describes how to use
   <a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
    <span class="command">
     <strong>
      mysqldump
     </strong>
    </span>
   </a>
   to
      produce dump files, and how to reload dump files. A dump file can
      be used in several ways:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      As a backup to enable data recovery in case of data loss.
     </p>
    </li>
    <li class="listitem">
     <p>
      As a source of data for setting up replicas.
     </p>
    </li>
    <li class="listitem">
     <p>
      As a source of data for experimentation:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         To make a copy of a database that you can use without
              changing the original data.
        </p>
       </li>
       <li class="listitem">
        <p>
         To test potential upgrade incompatibilities.
        </p>
       </li>
      </ul>
     </div>
    </li>
   </ul>
  </div>
  <p>
   <a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
    <span class="command">
     <strong>
      mysqldump
     </strong>
    </span>
   </a>
   produces two types of output,
      depending on whether the
   <a class="link" href="mysqldump.html#option_mysqldump_tab">
    <code class="option">
     --tab
    </code>
   </a>
   option is given:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      Without
      <a class="link" href="mysqldump.html#option_mysqldump_tab">
       <code class="option">
        --tab
       </code>
      </a>
      ,
      <a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
       <span class="command">
        <strong>
         mysqldump
        </strong>
       </span>
      </a>
      writes SQL statements to the
          standard output. This output consists of
      <code class="literal">
       CREATE
      </code>
      statements to create dumped objects
          (databases, tables, stored routines, and so forth), and
      <code class="literal">
       INSERT
      </code>
      statements to load data into tables.
          The output can be saved in a file and reloaded later using
      <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
       <span class="command">
        <strong>
         mysql
        </strong>
       </span>
      </a>
      to recreate the dumped objects.
          Options are available to modify the format of the SQL
          statements, and to control which objects are dumped.
     </p>
    </li>
    <li class="listitem">
     <p>
      With
      <a class="link" href="mysqldump.html#option_mysqldump_tab">
       <code class="option">
        --tab
       </code>
      </a>
      ,
      <a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
       <span class="command">
        <strong>
         mysqldump
        </strong>
       </span>
      </a>
      produces two output files for
          each dumped table. The server writes one file as tab-delimited
          text, one line per table row. This file is named
      <code class="filename">
       <em class="replaceable">
        <code>
         tbl_name
        </code>
       </em>
       .txt
      </code>
      in the output directory. The server also sends a
      <a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
       <code class="literal">
        CREATE TABLE
       </code>
      </a>
      statement for the
          table to
      <a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
       <span class="command">
        <strong>
         mysqldump
        </strong>
       </span>
      </a>
      , which writes it as a
          file named
      <code class="filename">
       <em class="replaceable">
        <code>
         tbl_name
        </code>
       </em>
       .sql
      </code>
      in the output directory.
     </p>
    </li>
   </ul>
  </div>
 </div>
 <br/>
</div>
