SHOW DATABASES

The SHOW DATABASES statement lists all databases in the CockroachDB cluster.

Synopsis

SHOWDATABASES

Required privileges

No privileges are required to list the databases in the CockroachDB cluster.

Example

  1. > SHOW DATABASES;
  1. +---------------+
  2. | database_name |
  3. +---------------+
  4. | defaultdb |
  5. | postgres |
  6. | system |
  7. +---------------+
  8. (3 rows)

Default databases

New clusters and existing clusters upgraded to v2.1 or later will include three auto-generated databases, with the following purposes:

  • The empty defaultdb database is used if a client does not specify a database in the connection parameters.

  • An empty database called postgres is provided for compatibility with Postgres client applications that require it.

  • The system database contains CockroachDB metadata and is read-only.

The postgres and defaultdb databases can be deleted if they are not needed.

See also

Was this page helpful?
YesNo