Cry MySQL How to...

List all the databases


To list all of the databases on the server currently connected to, use the following SQL:

show databases;

This will return a query result containing the names of all of each of the databases.

Alternatively (from MySQL 5) you could also use:

select SCHEMA_NAME from INFORMATION_SCHEMA.SCHEMATA

These notes have been tested against MySQL version 4 and 5.0.



About the author: is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.