<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="mysqldump-copying-database">
      </a>
      9.4.5.1 Making a Copy of a Database
     </h4>
    </div>
   </div>
  </div>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa18284688"><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-sql">$<span class="token operator">&gt;</span> mysqldump db1 <span class="token operator">&gt;</span> dump<span class="token punctuation">.</span><span class="token keyword">sql</span>
$<span class="token operator">&gt;</span> mysqladmin <span class="token keyword">create</span> db2
$<span class="token operator">&gt;</span> mysql db2 <span class="token operator">&lt;</span> dump<span class="token punctuation">.</span><span class="token keyword">sql</span></code></pre>
  </div>
  <p>
   Do not use
   <a class="link" href="mysqldump.html#option_mysqldump_databases">
    <code class="option">
     --databases
    </code>
   </a>
   on
          the
   <a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
    <span class="command">
     <strong>
      mysqldump
     </strong>
    </span>
   </a>
   command line because that
          causes
   <code class="literal">
    USE db1
   </code>
   to be included in the dump
          file, which overrides the effect of naming
   <code class="literal">
    db2
   </code>
   on the
   <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
    <span class="command">
     <strong>
      mysql
     </strong>
    </span>
   </a>
   command
          line.
  </p>
 </div>
 <br/>
</div>
