<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="show-databases">
      </a>
      15.7.7.15 SHOW DATABASES Statement
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045170734112">
  </a>
  <a class="indexterm" name="idm46045170733056">
  </a>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69204003"><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 keyword">SHOW</span> {<span class="token keyword">DATABASES</span> <span class="token operator">|</span> <span class="token keyword">SCHEMAS</span>}
    <span class="token punctuation">[</span><span class="token operator">LIKE</span> <span class="token string">'<em class="replaceable">pattern</em>'</span> <span class="token operator">|</span> <span class="token keyword">WHERE</span> <em class="replaceable">expr</em><span class="token punctuation">]</span></code></pre>
  </div>
  <p>
   <a class="link" href="show-databases.html" title="15.7.7.15 SHOW DATABASES Statement">
    <code class="literal">
     SHOW DATABASES
    </code>
   </a>
   lists the
        databases on the MySQL server host.
   <a class="link" href="show-databases.html" title="15.7.7.15 SHOW DATABASES Statement">
    <code class="literal">
     SHOW
        SCHEMAS
    </code>
   </a>
   is a synonym for
   <a class="link" href="show-databases.html" title="15.7.7.15 SHOW DATABASES Statement">
    <code class="literal">
     SHOW
        DATABASES
    </code>
   </a>
   . The
   <a class="link" href="string-comparison-functions.html#operator_like">
    <code class="literal">
     LIKE
    </code>
   </a>
   clause, if present, indicates which database names to match. The
   <code class="literal">
    WHERE
   </code>
   clause can be given to select rows
        using more general conditions, as discussed in
   <a class="xref" href="extended-show.html" title="28.8 Extensions to SHOW Statements">
    Section 28.8, “Extensions to SHOW Statements”
   </a>
   .
  </p>
  <p>
   You see only those databases for which you have some kind of
        privilege, unless you have the global
   <a class="link" href="show-databases.html" title="15.7.7.15 SHOW DATABASES Statement">
    <code class="literal">
     SHOW
        DATABASES
    </code>
   </a>
   privilege. You can also get this list using
        the
   <a class="link" href="mysqlshow.html" title="6.5.6 mysqlshow — Display Database, Table, and Column Information">
    <span class="command">
     <strong>
      mysqlshow
     </strong>
    </span>
   </a>
   command.
  </p>
  <p>
   If the server was started with the
   <a class="link" href="server-options.html#option_mysqld_skip-show-database">
    <code class="option">
     --skip-show-database
    </code>
   </a>
   option, you
        cannot use this statement at all unless you have the
   <a class="link" href="privileges-provided.html#priv_show-databases">
    <code class="literal">
     SHOW DATABASES
    </code>
   </a>
   privilege.
  </p>
  <p>
   MySQL implements databases as directories in the data directory,
        so this statement simply lists directories in that location.
        However, the output may include names of directories that do not
        correspond to actual databases.
  </p>
  <p>
   Database information is also available from the
   <code class="literal">
    INFORMATION_SCHEMA
   </code>
   <a class="link" href="information-schema-schemata-table.html" title="28.3.31 The INFORMATION_SCHEMA SCHEMATA Table">
    <code class="literal">
     SCHEMATA
    </code>
   </a>
   table. See
   <a class="xref" href="information-schema-schemata-table.html" title="28.3.31 The INFORMATION_SCHEMA SCHEMATA Table">
    Section 28.3.31, “The INFORMATION_SCHEMA SCHEMATA Table”
   </a>
   .
  </p>
  <div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Caution
   </div>
   <p>
    Because any static global privilege is considered a privilege
          for all databases, any static global privilege enables a user
          to see all database names with
    <a class="link" href="show-databases.html" title="15.7.7.15 SHOW DATABASES Statement">
     <code class="literal">
      SHOW
          DATABASES
     </code>
    </a>
    or by examining the
    <a class="link" href="information-schema-schemata-table.html" title="28.3.31 The INFORMATION_SCHEMA SCHEMATA Table">
     <code class="literal">
      SCHEMATA
     </code>
    </a>
    table of
    <code class="literal">
     INFORMATION_SCHEMA
    </code>
    , except databases that
          have been restricted at the database level by partial revokes.
   </p>
  </div>
 </div>
 <br/>
</div>
