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 to show existing databases in MySQL
Following is the syntax of SQL query to show list of existing databases in MySQL from command line :
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.
Three databases (db1, db2 and db3) have been created and SHOW DATABASES; query successfully listed them down in the mysql prompt.
In our next tutorial, we shall learn how to select a database and use it for table operations.