在MySQL Command Line Client中如何查询MySQL服务器中的所有数据库名称。

解决方案 »

  1.   

    select `SCHEMA_NAME` from `information_schema`.`SCHEMATA`;
      

  2.   

    MySQL官方文档 http://dev.mysql.com/doc/refman/5.1/zh/index.html
      

  3.   


    127.0.0.1~root@localhost~test>show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | cpc                |
    | db1                |
    | mysql              |
    | test               |
    +--------------------+
    5 rows in set (0.00 sec)