MySQL SHOW DATABASES Statement



MySQL SHOW DATABASES Statement

The MySQL SHOW DATABASES statement is used to list all the databases present in the MySQL server. This statement is essential for viewing the existing databases and confirming database creation.


Syntax

SHOW DATABASES;

The SHOW DATABASES statement does not have any optional clauses or parameters. It simply lists all databases available on the MySQL server.


Example MySQL SHOW DATABASES Statement

Let's look at an example of the MySQL SHOW DATABASES statement and how to interpret its output:

Step 1: Listing All Databases

SHOW DATABASES;

This query lists all databases on the MySQL server. The result will be a list of all database names available in the MySQL server.

MySQL SHOW DATABASES

Step 2: Interpreting the Output

The output of the SHOW DATABASES statement will be a list of database names. For example:

MySQL SHOW DATABASES Output

In this example, the output lists five databases: information_schema, mysql, performance_schema, sys, and mydatabase.


Conclusion

The MySQL SHOW DATABASES statement is a straightforward but powerful tool for listing all databases on the MySQL server. Understanding how to use this statement is essential for database management and verification in MySQL.