List MySQL Databases Using SQL Query



With the help of following MySQL query, we can see the list of MySQL database −

mysql> SELECT schema_name FROM information_schema.schemata;
+--------------------+
| schema_name        |
+--------------------+
| information_schema |
| gaurav             |
| mysql              |
| performance_schema |
| query              |
| query1             |
| sys                |
| tutorials          |
+--------------------+
8 rows in set (0.00 sec)

We can also use WHERE clause with this query as follows −

mysql> SELECT schema_name FROM information_schema.schemata WHERE schema_name LIKE '%schema' OR schema_name LIKE '%s';
+--------------------+
| schema_name        |
+--------------------+
| information_schema |
| performance_schema |
| sys                |
| tutorials          |
+--------------------+
4 rows in set (0.00 sec)
Updated on: 2020-06-20T12:56:32+05:30

100 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements