Updated on 2026-11-06 GMT+08:00

Show All Databases

Function

Shows all databases under the current project. The LIKE clause can be used to filter database names by regular expression pattern. If no pattern is provided, all databases in the system are listed.

Syntax

1
SHOW [DATABASES | SCHEMAS] [LIKE regex_expression];

Keywords

  • LIKE: Filter results using a regular expression pattern.
  • DATABASES/SCHEMAS: Both are equivalent and can be used.

Parameters

Table 1 Parameter description

Parameter

Description

regex_expression

A regular expression used to filter results. Except for * and |, the pattern works the same as a regular expression.

* can be used to match zero or more characters, and | is used to separate multiple different regular expressions. Pattern matching is case-insensitive.

Precautions

DATABASES and SCHEMAS are equivalent and both return all database names.

Example 1: List All Databases

View all databases in the current instance.

SHOW DATABASES;

Table 2 Example result

databaseName

default

payments_db

payroll_db

Example 2: Filter Databases by Pattern

View all database names starting with pay.

SHOW DATABASES LIKE 'pay*';

Table 3 Example result

databaseName

payments_db

payroll_db

Example 3: Use the SCHEMAS Keyword

SCHEMAS is equivalent to DATABASES and can be used interchangeably.

SHOW SCHEMAS;

Example 4: Filter Using Multiple Patterns

View databases starting with pay or hr.

SHOW DATABASES LIKE 'pay*|hr*';