众所周知,借助SHOW DATABASES语句,我们可以看到MySQL数据库列表。同样,我们可以使用SHOW SCHEMAS作为SHOW DATABASES的同义词来获取数据库列表。
mysql> SHOW DATABASES; +--------------------+ | Database | +--------------------+ | information_schema | | gaurav | | mysql | | performance_schema | | query | | query1 | | sys | | tutorials | +--------------------+ 8 rows in set (0.07 sec) mysql> SHOW SCHEMAS; +--------------------+ | Database | +--------------------+ | information_schema | | gaurav | | mysql | | performance_schema | | query | | query1 | | sys | | tutorials | +--------------------+ 8 rows in set (0.00 sec)