Using SHOW to list all databases on a server

To show a list of all of the databases on a server that the current user is allowed to see, use the SHOW DATABASES command as in the following example:

MariaDB [(none)]> SHOW DATABASES; 
+--------------------+ 
| Database           | 
+--------------------+ 
| dbt3_s001          | 
| flightstats        | 
| ham                | 
| information_schema | 
| isfdb              | 
| lds_scriptures     | 
| library            | 
| mysql              | 
| performance_schema | 
| test               | 
| wikidb             | 
+--------------------+ 
11 rows in set (0.00 sec) 

MariaDB [(none)]>

The preceding example is from my personal install of MariaDB; the databases listed when you run the command will almost assuredly be different. This command is useful especially if you're given access to an existing MariaDB ...

Get Getting Started with MariaDB - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.