Syntax:
SHOW {DATABASES | SCHEMAS}
    [LIKE 'pattern' | WHERE expr]

SHOW DATABASES lists the databases on the MySQL server host. SHOW
SCHEMAS is a synonym for SHOW DATABASES. The LIKE clause, if present,
indicates which database names to match. The WHERE clause can be given
to select rows using more general conditions, as discussed in
https://dev.mysql.com/doc/refman/8.0/en/extended-show.html.

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

If the server was started with the --skip-show-database option, you
cannot use this statement at all unless you have the SHOW 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 the INFORMATION_SCHEMA
SCHEMATA table. See
https://dev.mysql.com/doc/refman/8.0/en/information-schema-schemata-tab
le.html.

*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 with SHOW DATABASES or by examining the SCHEMATA table
of INFORMATION_SCHEMA, except databases that have been restricted at
the database level by partial revokes.

URL: https://dev.mysql.com/doc/refman/8.0/en/show-databases.html

