Name
SHOW DATABASES
Synopsis
SHOW {DATABASES|SCHEMAS} [LIKE 'pattern'| WHERE expression]This statement displays the list of databases on the server.
The keyword DATABASE is synonymous with
SCHEMA as of version 5.0.2 of MySQL. Using the
LIKE clause, a naming pattern may be given. Or you may use the
WHERE clause to refine the results set.
For example, suppose that a server has a separate database for
each customer of the organization and that the pattern for the names
of the databases is
cust_, where the
numbernumber is the customer account number. You
could enter the following SQL statement to obtain a list of databases
based on this pattern:
SHOW DATABASES LIKE 'cust%' LIMIT 1; +------------------+ | Database (cust%) | +------------------+ | cust_37881 | +------------------+
The SHOW DATABASES privilege is necessary to
see all databases. Otherwise, the user will see only the databases for
which he has privileges. The --skip-show-database
server option will disable this
limitation.
The mysqlshow utility can be used at the
command line to view the same information:
mysqlshow --user=user --passwordThe results from this utility are also limited by the user’s privileges.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access