DATABASES is most often encountered in the MySQL-family statement SHOW DATABASES, which returns a result set containing every logical database (also called a schema) that lives inside the running server instance. The statement reads from the system catalog, so results reflect the latest committed state. On privileged accounts the list is complete; on limited accounts it contains only databases the user can access. Optional LIKE or WHERE clauses narrow the result set with pattern matching or arbitrary expressions against the INFORMATION_SCHEMA.SCHEMATA columns. Some vendors call databases “schemas,” so other dialects expose the same information through different keywords or system tables rather than the DATABASES keyword itself.
pattern
(STRING) - Optional pattern with % and _ wildcards evaluated against database names.expression
(SQL expression) - Optional boolean condition referencing INFORMATION_SCHEMA.SCHEMATA columns (e.g., DEFAULT_CHARACTER_SET_NAME).SHOW, CREATE DATABASE, DROP DATABASE, SCHEMAS, INFORMATION_SCHEMA.SCHEMATA
MySQL 3.22
Use LIKE with wildcards:```SHOW DATABASES LIKE 'test%';```
SHOW DATABASES respects privileges. Your user can only see databases for which it has some permission. Ask an administrator for the SHOW DATABASES or global SHOW privilege.
No. The command is read-only and does not lock databases or tables.
They are synonyms in MySQL. Both return the same result set.