思路:
1 mysql> show databases; 2 +--------------------+ 3 | Database | 4 +--------------------+ 5 | information_schema | 6 | challenges | 7 | mysql | 8 | performance_schema | 9 | phpmyadmin | 10 | ro1 | 11 | security | 12 +--------------------+ 13 7 rows in set (0.01 sec) 14 15 mysql> select * from information_schema; 16 ERROR 1046 (3D000): No database selected 17 mysql> use ro1;#随便用一个数据库 18 Database changed
1 +--------------+--------------------+----------------------------+------------------------+----------+ 2 | CATALOG_NAME | SCHEMA_NAME | DEFAULT_CHARACTER_SET_NAME | DEFAULT_COLLATION_NAME | SQL_PATH | 3 +--------------+--------------------+----------------------------+------------------------+----------+ 4 | def | information_schema | utf8 | utf8_general_ci | NULL | 5 | def | challenges | gbk | gbk_chinese_ci | NULL | 6 | def | mysql | latin1 | latin1_swedish_ci | NULL | 7 | def | performance_schema | utf8 | utf8_general_ci | NULL | 8 | def | phpmyadmin | utf8 | utf8_bin | NULL | 9 | def | ro1 | utf8 | utf8_general_ci | NULL | 10 | def | security | gbk | gbk_chinese_ci | NULL | 11 +--------------+--------------------+----------------------------+------------------------+----------+ 12 7 rows in set (0.00 sec) 13 14 mysql> select schema_name from information_schema.schemata limit 1,1; 15 +-------------+ 16 | schema_name | 17 +-------------+ 18 | challenges | 19 +-------------+ 20 1 row in set (0.00 sec)