可以使用哪些 MySQL 查询来查看 MySQL 数据库的列表?


使用以下 MySQL 查询,我们可以看到 MySQL 数据库的列表 -

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)

我们还可以在此查询中使用 WHERE 子句,如下所示 -

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)

更新于: 2020 年 6 月 20 日

71 次浏览

开启您的 事业

完成课程获得认证

开始
广告
© . All rights reserved.