MySQL – Show Databases

Many databases could be created and used simultaneously in MySQL. Usually a database serves an application. And different applications can connect to the same MySQL server to access different databases. With the context that there can exist multiple databases in MySQL Server, we shall learn how to view or show existing databases in MySQL.

Syntax – Show Databases

Following is the syntax of SQL query to show list of existing databases in MySQL from command line.

</>
Copy
SHOW DATABASES;

Now, we shall quickly create some databases and check if they are displayed in the list shown by “SHOW DATABASES” sql query in the mysql command prompt.

Show existing DATABASES in MySQL
Show list of existing DATABASES in MySQL

Three databases (db1, db2 and db3) have been created and SHOW DATABASES; query successfully listed them down in the mysql prompt.

Conclusion

In this MySQL Tutorial, we learned how to get the list of all databases present in MySQL.

In our next tutorial, we shall learn how to select a database and use it for table operations.