Multiple ways to display the list of databases in MySQL

The list of databases is frequently viewed by developers and DBAs. There are alternative methods for seeing the databases depending on whether you want to see the database names alone, or the database names along with their other attributes such as its tables, created date, updated date, number of rows in it, data length, etc.

Method # 1:
In the MySQL shell or any GUI, issue the below command to display the list of the databases.

The result will be something like this-

| Database          |
| Database1         |
| Database2         |
| Database3         |
| Database4         |

Method # 2
SELECT * FROM information_schema.TABLES;
All of the metadata pertaining to the databases and their contents will be returned. their data type, length, number of rows, last modification date, and table creation date.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s