Documentation Home
MySQL 9.4 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 41.2Mb
PDF (A4) - 41.3Mb
Man Pages (TGZ) - 262.8Kb
Man Pages (Zip) - 368.8Kb
Info (Gzip) - 4.1Mb
Info (Zip) - 4.1Mb


15.7.7.16 SHOW DATABASES Statement

SHOW {DATABASES | SCHEMAS}    [LIKE 'pattern' | WHEREexpr]

SHOW DATABASES lists the databases on the MySQL server host.SHOW SCHEMAS is a synonym forSHOW DATABASES. TheLIKE clause, if present, indicates which database names to match. TheWHERE clause can be given to select rows using more general conditions, as discussed inSection 28.8, “Extensions to SHOW Statements”.

You see only those databases for which you have some kind of privilege, unless you have the globalSHOW DATABASES privilege. You can also get this list using themysqlshow command.

If the server was started with the--skip-show-database option, you cannot use this statement at all unless you have theSHOW DATABASES privilege.

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.

Database information is also available from theINFORMATION_SCHEMASCHEMATA table. SeeSection 28.3.37, “The INFORMATION_SCHEMA SCHEMATA Table”.

Caution

Because any static global privilege is considered a privilege for all databases, any static global privilege enables a user to see all database names withSHOW DATABASES or by examining theSCHEMATA table ofINFORMATION_SCHEMA, except databases that have been restricted at the database level by partial revokes.