Show Databases in MySQL
Introduction
After creating multiple databases in MySQL, you may want to view all available databases on your system.
MySQL provides a simple command to display a list of all databases. This helps you check existing databases and select the one you want to work with.
What is SHOW DATABASES
The SHOW DATABASES statement is used to display all databases available in the MySQL server.
It lists both:
System databases
User-created databases
Basic Syntax
SHOW DATABASES; Example
SHOW DATABASES; Output may look like:
information_schema
mysql
performance_schema
sys
school
student_db
Understanding the Output
Some databases are created by MySQL by default:
information_schema → stores metadata
MySQL → stores user and permission data
performance_schema → performance-related data
sys → system information
Your created databases (like school, student_db) will also appear in the list.
When to Use SHOW DATABASES
You should use this command when:
You want to see all available databases
You forgot the exact database name
You want to verify database creation
You are switching between databases
Filtering Databases (Optional)
You can also filter results using LIKE:
SHOW DATABASES LIKE 's%'; This will show databases that start with the letter s.
Example Scenario
After creating a database:
CREATE DATABASE company_db; You can verify it using:
SHOW DATABASES; If company_db appears in the list, it has been successfully created.
Common Mistakes
Expecting only user-created databases (system databases also appear)
Forgetting to refresh or re-run the command
Typing incorrect syntax
Key Points to Remember
SHOW DATABASESdisplays all databasesIncludes both system and user-created databases
Helps verify database creation
Can be filtered using LIKE