List schemas in MySQL database

The query below lists databases (schemas) on MySQL instance.

Query

A. Generic query

select schema_name as database_name
from information_schema.schemata
order by schema_name;

B. Show statement (option 1)

show databases;

C. Show statement (option 2)

show schemas;

Columns

  • schema_name - database (schema) name

Rows

  • One row: represents one database (schema)
  • Scope of rows: all databases (schemas) on MySQL instance
  • Ordered by: database (schema) name

Sample results

Below is the sample results generated by Generic query (option A).

View of databases (schemas) in MySQL Workbench. Blue rectangle selects system databases (schemas).

Comments are only visible when the visitor has consented to statistics cookies. To see and add comments please accept statistics cookies.
0
There are no comments. Click here to write the first comment.