mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| crashcourse |
| mysql |
| school |
| test |
+--------------------+
6 rows in set (0.00 sec)
+--------------------+
| Database |
+--------------------+
| information_schema |
| crashcourse |
| mysql |
| school |
| test |
+--------------------+
6 rows in set (0.00 sec)
mysql> select table_schema,table_type,table_name from tables;
+--------------------+-------------+---------------------------------------+
| table_schema | table_type | table_name |
+--------------------+-------------+---------------------------------------+
| information_schema | SYSTEM VIEW | CHARACTER_SETS |
| information_schema | SYSTEM VIEW | COLLATIONS |
| information_schema | SYSTEM VIEW | COLLATION_CHARACTER_SET_APPLICABILITY |
| information_schema | SYSTEM VIEW | COLUMNS |
| information_schema | SYSTEM VIEW | COLUMN_PRIVILEGES |
| information_schema | SYSTEM VIEW | ENGINES |
| information_schema | SYSTEM VIEW | EVENTS |
| information_schema | SYSTEM VIEW | FILES |
| information_schema | SYSTEM VIEW | GLOBAL_STATUS |
| information_schema | SYSTEM VIEW | GLOBAL_VARIABLES |
| information_schema | SYSTEM VIEW | KEY_COLUMN_USAGE |
| information_schema | SYSTEM VIEW | PARTITIONS |
| information_schema | SYSTEM VIEW | PLUGINS |
| information_schema | SYSTEM VIEW | PROCESSLIST |
| information_schema | SYSTEM VIEW | PROFILING |
| information_schema | SYSTEM VIEW | REFERENTIAL_CONSTRAINTS |
| information_schema | SYSTEM VIEW | ROUTINES |
| information_schema | SYSTEM VIEW | SCHEMATA |
| information_schema | SYSTEM VIEW | SCHEMA_PRIVILEGES |
| information_schema | SYSTEM VIEW | SESSION_STATUS |
| information_schema | SYSTEM VIEW | SESSION_VARIABLES |
| information_schema | SYSTEM VIEW | STATISTICS |
| information_schema | SYSTEM VIEW | TABLES |
| information_schema | SYSTEM VIEW | TABLE_CONSTRAINTS |
| information_schema | SYSTEM VIEW | TABLE_PRIVILEGES |
| information_schema | SYSTEM VIEW | TRIGGERS |
| information_schema | SYSTEM VIEW | USER_PRIVILEGES |
| information_schema | SYSTEM VIEW | VIEWS |
| crashcourse | BASE TABLE | customers |
| crashcourse | VIEW | my_view_vendorlocations |
| crashcourse | VIEW | myview |
| crashcourse | BASE TABLE | orderitems |
| crashcourse | BASE TABLE | orders |
| crashcourse | BASE TABLE | productnotes |
| crashcourse | BASE TABLE | products |
| crashcourse | BASE TABLE | test_table |
| crashcourse | BASE TABLE | vendors |
| crashcourse | VIEW | view_orderitemsexpanded |
| mysql | BASE TABLE | columns_priv |
| mysql | BASE TABLE | db |
| mysql | BASE TABLE | event |
| mysql | BASE TABLE | func |
| mysql | BASE TABLE | general_log |
| mysql | BASE TABLE | help_category |
| mysql | BASE TABLE | help_keyword |
| mysql | BASE TABLE | help_relation |
| mysql | BASE TABLE | help_topic |
| mysql | BASE TABLE | host |
| mysql | BASE TABLE | ndb_binlog_index |
| mysql | BASE TABLE | plugin |
| mysql | BASE TABLE | proc |
| mysql | BASE TABLE | procs_priv |
| mysql | BASE TABLE | servers |
| mysql | BASE TABLE | slow_log |
| mysql | BASE TABLE | tables_priv |
| mysql | BASE TABLE | time_zone |
| mysql | BASE TABLE | time_zone_leap_second |
| mysql | BASE TABLE | time_zone_name |
| mysql | BASE TABLE | time_zone_transition |
| mysql | BASE TABLE | time_zone_transition_type |
| mysql | BASE TABLE | user |
| school | BASE TABLE | teacher |
| school | BASE TABLE | teacher2 |
| test | BASE TABLE | t |
+--------------------+-------------+---------------------------------------+
68 rows in set (0.01 sec)
+--------------------+-------------+---------------------------------------+
| table_schema | table_type | table_name |
+--------------------+-------------+---------------------------------------+
| information_schema | SYSTEM VIEW | CHARACTER_SETS |
| information_schema | SYSTEM VIEW | COLLATIONS |
| information_schema | SYSTEM VIEW | COLLATION_CHARACTER_SET_APPLICABILITY |
| information_schema | SYSTEM VIEW | COLUMNS |
| information_schema | SYSTEM VIEW | COLUMN_PRIVILEGES |
| information_schema | SYSTEM VIEW | ENGINES |
| information_schema | SYSTEM VIEW | EVENTS |
| information_schema | SYSTEM VIEW | FILES |
| information_schema | SYSTEM VIEW | GLOBAL_STATUS |
| information_schema | SYSTEM VIEW | GLOBAL_VARIABLES |
| information_schema | SYSTEM VIEW | KEY_COLUMN_USAGE |
| information_schema | SYSTEM VIEW | PARTITIONS |
| information_schema | SYSTEM VIEW | PLUGINS |
| information_schema | SYSTEM VIEW | PROCESSLIST |
| information_schema | SYSTEM VIEW | PROFILING |
| information_schema | SYSTEM VIEW | REFERENTIAL_CONSTRAINTS |
| information_schema | SYSTEM VIEW | ROUTINES |
| information_schema | SYSTEM VIEW | SCHEMATA |
| information_schema | SYSTEM VIEW | SCHEMA_PRIVILEGES |
| information_schema | SYSTEM VIEW | SESSION_STATUS |
| information_schema | SYSTEM VIEW | SESSION_VARIABLES |
| information_schema | SYSTEM VIEW | STATISTICS |
| information_schema | SYSTEM VIEW | TABLES |
| information_schema | SYSTEM VIEW | TABLE_CONSTRAINTS |
| information_schema | SYSTEM VIEW | TABLE_PRIVILEGES |
| information_schema | SYSTEM VIEW | TRIGGERS |
| information_schema | SYSTEM VIEW | USER_PRIVILEGES |
| information_schema | SYSTEM VIEW | VIEWS |
| crashcourse | BASE TABLE | customers |
| crashcourse | VIEW | my_view_vendorlocations |
| crashcourse | VIEW | myview |
| crashcourse | BASE TABLE | orderitems |
| crashcourse | BASE TABLE | orders |
| crashcourse | BASE TABLE | productnotes |
| crashcourse | BASE TABLE | products |
| crashcourse | BASE TABLE | test_table |
| crashcourse | BASE TABLE | vendors |
| crashcourse | VIEW | view_orderitemsexpanded |
| mysql | BASE TABLE | columns_priv |
| mysql | BASE TABLE | db |
| mysql | BASE TABLE | event |
| mysql | BASE TABLE | func |
| mysql | BASE TABLE | general_log |
| mysql | BASE TABLE | help_category |
| mysql | BASE TABLE | help_keyword |
| mysql | BASE TABLE | help_relation |
| mysql | BASE TABLE | help_topic |
| mysql | BASE TABLE | host |
| mysql | BASE TABLE | ndb_binlog_index |
| mysql | BASE TABLE | plugin |
| mysql | BASE TABLE | proc |
| mysql | BASE TABLE | procs_priv |
| mysql | BASE TABLE | servers |
| mysql | BASE TABLE | slow_log |
| mysql | BASE TABLE | tables_priv |
| mysql | BASE TABLE | time_zone |
| mysql | BASE TABLE | time_zone_leap_second |
| mysql | BASE TABLE | time_zone_name |
| mysql | BASE TABLE | time_zone_transition |
| mysql | BASE TABLE | time_zone_transition_type |
| mysql | BASE TABLE | user |
| school | BASE TABLE | teacher |
| school | BASE TABLE | teacher2 |
| test | BASE TABLE | t |
+--------------------+-------------+---------------------------------------+
68 rows in set (0.01 sec)
可以使用USE语句将
INFORMATION_SCHEMA
选择为默认数据库,但访问该数据库中所含表的唯一方式是使用SELECT语句。不能在其中插入内容,不能更新它们,也不能删除其中的内容。
扩展了一些SHOW语句,允许使用WHERE子句:
SHOW CHARACTER SET
SHOW COLLATION
SHOW COLUMNS
SHOW DATABASES
SHOW FUNCTION STATUS
SHOW KEYS
SHOW OPEN TABLES
SHOW PROCEDURE STATUS
SHOW STATUS
SHOW TABLE STATUS
SHOW TABLES
SHOW VARIABLES