This MySQL statement displays the list of databases on the server. The keyword DATABASE has become synomymous with SCHEMA.


Below is the syntax for this command. Text within square brackets (i.e, [ and ] ) are optional. Choices are separated by bars (i.e, | ). Ellipses preceded by a comma indicates a repeating pattern. Ellipses before or after syntax are used to highlight a relevant except from the larger syntax. Text displayed in italic letters represent text that should be replaced with the specific names related to the database (e.g., column with the name of the column).

SHOW {DATABASES|SCHEMAS} [LIKE 'pattern'| WHERE expression]


This statement displays the list of databases on the server. The keyword DATABASE is synomymous 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_number, where the number is the customer account number. You could enter the following SQL statement to obtain a list of databases based on this pattern:


| 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 --password

The results from this utility is also limited by the user's privileges.