INFORMATION_SCHEMA信息数据库----有时也称“数据词典”和“系统目录”

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| crashcourse        |
| mysql              |
| school             |
| test               |
+--------------------+
6 rows in set (0.00 sec)

mysql下面的INFORMATION_SCHEMA信息数据库的作用:   INFORMATION_SCHEMA是信息数据库,其中保存着关于MySQL服务器所维护的所有其他数据库的信息。          INFORMATION_SCHEMA中,有数个只读表 。它们实际上是视图,而不是基本表,因此,你将无法看到与之相关的任何文件。

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)

可以使用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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值