Skip to content

Latest commit

 

History

History
63 lines (49 loc) · 1.78 KB

sql-statement-show-databases.md

File metadata and controls

63 lines (49 loc) · 1.78 KB
title summary aliases
SHOW DATABASES | TiDB SQL Statement Reference
An overview of the usage of SHOW DATABASES for the TiDB database.
/docs/dev/sql-statements/sql-statement-show-databases/
/docs/dev/reference/sql/statements/show-databases/

SHOW DATABASES

This statement shows a list of databases that the current user has privileges to. Databases which the current user does not have access to will appear hidden from the list. The information_schema database always appears first in the list of databases.

SHOW SCHEMAS is an alias of this statement.

Synopsis

ShowDatabasesStmt ::=
    "SHOW" "DATABASES" ShowLikeOrWhere?

ShowLikeOrWhere ::=
    "LIKE" SimpleExpr
|   "WHERE" Expression

Examples

mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| INFORMATION_SCHEMA |
| PERFORMANCE_SCHEMA |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql> CREATE DATABASE mynewdb;
Query OK, 0 rows affected (0.10 sec)

mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| INFORMATION_SCHEMA |
| PERFORMANCE_SCHEMA |
| mynewdb            |
| mysql              |
| test               |
+--------------------+
5 rows in set (0.00 sec)

MySQL compatibility

The SHOW DATABASES statement in TiDB is fully compatible with MySQL. If you find any compatibility differences, report a bug.

See also