天天看点

查询 MySQL 实例上所有数据库

调试环境:CentOS 7.6

安装版本:MySQL Community Server (5.6.43)

调试人员:成长的小猪 Jason Song 

通过以下方法我们可以查询到当前实例中所有的数据库列表

第一种 通过 SHOW 命令查询(方式一)

show databases;
           

第二种 通过 SHOW 命令查询(方式二)

show schemas;
           

第三种 通过 SQL 语句查询

select schema_name 
from information_schema.schemata;
           

以下就是通过上面的方法查询到的结果

查询 MySQL 实例上所有数据库