如何返回 MySQL 中的数据库列表?
返回数据库列表的语法如下所示 −
select schema_name as anyAliasName from information_schema.schemata;
以下是 MySQL 中返回数据库列表的查询 −
mysql> select schema_name as DatabaseName from information_schema.schemata;
这会生成以下输出 −
+---------------------------+ | DatabaseName | +---------------------------+ | mysql | | information_schema | | performance_schema | | sys | | business | | sample | | hello | | test | | mybusiness | | databasesample | | schemasample | | universitydatabase | | education | | mydatabase | | database1 | | sampledatabase | | test3 | | javadatabase2 | | javasampledatabase | | rdb | | onetomanyrelationship | | webtracker | | web | | commandline | | hb_student_tracker | | bothinnodbandmyisam | | customertracker | | tracker | | demo | | customer_tracker_database | | login | | onlinebookstore | | customer-tracker | | web_tracker | | instant_app | | 1233 | +---------------------------+ 36 rows in set (0.00 sec)
广告