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 - 图1

ShowLikeOrWhere

SHOW DATABASES - 图2

  1. ShowDatabasesStmt ::=
  2. "SHOW" "DATABASES" ShowLikeOrWhere?
  3. ShowLikeOrWhere ::=
  4. "LIKE" SimpleExpr
  5. | "WHERE" Expression

Examples

  1. mysql> SHOW DATABASES;
  2. +--------------------+
  3. | Database |
  4. +--------------------+
  5. | INFORMATION_SCHEMA |
  6. | PERFORMANCE_SCHEMA |
  7. | mysql |
  8. | test |
  9. +--------------------+
  10. 4 rows in set (0.00 sec)
  11. mysql> CREATE DATABASE mynewdb;
  12. Query OK, 0 rows affected (0.10 sec)
  13. mysql> SHOW DATABASES;
  14. +--------------------+
  15. | Database |
  16. +--------------------+
  17. | INFORMATION_SCHEMA |
  18. | PERFORMANCE_SCHEMA |
  19. | mynewdb |
  20. | mysql |
  21. | test |
  22. +--------------------+
  23. 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