zoukankan      html  css  js  c++  java
  • information_schema

    server层统计

    权限问题:

    1、所有用户都有访问information_schema下的表权限(但只能看到这些表中用户具有访问权限的对象相对应的数据行),但只能访问Server层的部分数据字典表.
    2、Server层中的部分数据字典表以及InnoDB层的数据字典表需要额外授权才能访问,如果用户权限不足,当查询Server层数据字典表时将不会返回任何数据,或者某个列没有权限访问时,该列返回NULL值。
    3、当查询InnoDB数据字典表时将直接拒绝访问(要访问这些表需要有process权限,注意不是select权限)
    4、从information_schema中查询相关数据需要的权限也适用于SHOW语句。无论使用哪种查询方式,都必须拥有某个对象的权限才能看到相关的数据。 
    ####################
    process和show

     所有数据库详情

     1 mysql> select * from SCHEMATA;
     2 +--------------+--------------------+----------------------------+------------------------+----------+
     3 | CATALOG_NAME | SCHEMA_NAME        | DEFAULT_CHARACTER_SET_NAME | DEFAULT_COLLATION_NAME | SQL_PATH |
     4 +--------------+--------------------+----------------------------+------------------------+----------+
     5 | def          | information_schema | utf8                       | utf8_general_ci        | NULL     |
     6 | def          | apple              | utf8mb4                    | utf8mb4_general_ci     | NULL     |
     7 | def          | mysql              | utf8mb4                    | utf8mb4_general_ci     | NULL     |
     8 | def          | performance_schema | utf8                       | utf8_general_ci        | NULL     |
     9 | def          | sys                | utf8                       | utf8_general_ci        | NULL     |
    10 +--------------+--------------------+----------------------------+------------------------+----------+
    11 5 rows in set (0.05 sec)
    12 
    13 mysql>

     tables表:

    ser@hostname (information_schema) > desc tables;
    +-----------------+---------------------+------+-----+---------+-------+
    | field           | type                | null | key | default | extra |
    +-----------------+---------------------+------+-----+---------+-------+
    | table_catalog   | varchar(512)        | no   |     |         |       |
    | table_schema    | varchar(64)         | no   |     |         |       | 数据库名称
    | table_name      | varchar(64)         | no   |     |         |       | 表名称
    | table_type      | varchar(64)         | no   |     |         |       | 表类型
    | engine          | varchar(64)         | yes  |     | null    |       | 存储引擎
    | version         | bigint(21) unsigned | yes  |     | null    |       |
    | row_format      | varchar(20)         | yes  |     | null    |       |
    | table_rows      | bigint(21) unsigned | yes  |     | null    |       | 行数
    | avg_row_length  | bigint(21) unsigned | yes  |     | null    |       |
    | data_length     | bigint(21) unsigned | yes  |     | null    |       | 数据大小
    | max_data_length | bigint(21) unsigned | yes  |     | null    |       |
    | index_length    | bigint(21) unsigned | yes  |     | null    |       | 索引大小
    | data_free       | bigint(21) unsigned | yes  |     | null    |       |
    | auto_increment  | bigint(21) unsigned | yes  |     | null    |       | 自增长度
    | create_time     | datetime            | yes  |     | null    |       | 创建时间
    | update_time     | datetime            | yes  |     | null    |       | 更新时间
    | check_time      | datetime            | yes  |     | null    |       |
    | table_collation | varchar(32)         | yes  |     | null    |       |
    | checksum        | bigint(21) unsigned | yes  |     | null    |       |
    | create_options  | varchar(255)        | yes  |     | null    |       |
    | table_comment   | varchar(2048)       | no   |     |         |       | 注释
    +-----------------+---------------------+------+-----+---------+-------+
    21 rows in set (0.00 sec)
    *************************** 19. row ***************************
      TABLE_CATALOG: def
       TABLE_SCHEMA: statistics
         TABLE_NAME: user_2019_08
         TABLE_TYPE: BASE TABLE
             ENGINE: InnoDB
            VERSION: 10
         ROW_FORMAT: Compressed
         TABLE_ROWS: 351716565
     AVG_ROW_LENGTH: 37
        DATA_LENGTH: 13293322240
    MAX_DATA_LENGTH: 0
       INDEX_LENGTH: 10047455232
          DATA_FREE: 3670016
     AUTO_INCREMENT: 381762867
        CREATE_TIME: 2019-09-10 22:59:33
        UPDATE_TIME: NULL
         CHECK_TIME: NULL
    TABLE_COLLATION: utf8_general_ci
           CHECKSUM: NULL
     CREATE_OPTIONS: row_format=COMPRESSED
      TABLE_COMMENT: 原来的表已经很大了,新指标做在这张表里

    所有存储引擎详情

     1 mysql>  select * from ENGINES order by ENGINE;
     2 +--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
     3 | ENGINE             | SUPPORT | COMMENT                                                        | TRANSACTIONS | XA   | SAVEPOINTS |
     4 +--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
     5 | ARCHIVE            | YES     | Archive storage engine                                         | NO           | NO   | NO         |
     6 | BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
     7 | CSV                | YES     | CSV storage engine                                             | NO           | NO   | NO         |
     8 | FEDERATED          | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |
     9 | InnoDB             | DEFAULT | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
    10 | MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
    11 | MRG_MYISAM         | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
    12 | MyISAM             | YES     | MyISAM storage engine                                          | NO           | NO   | NO         |
    13 | PERFORMANCE_SCHEMA | YES     | Performance Schema                                             | NO           | NO   | NO         |
    14 +--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
    15 9 rows in set (0.01 sec)
    16 
    17 mysql>

    innodb层

    锁、事务

     1 mysql> show create table innodb_locksG;
     2 *************************** 1. row ***************************
     3        Table: INNODB_LOCKS
     4 Create Table: CREATE TEMPORARY TABLE `INNODB_LOCKS` (
     5   `lock_id` varchar(81) NOT NULL DEFAULT '',
     6   `lock_trx_id` varchar(18) NOT NULL DEFAULT '',
     7   `lock_mode` varchar(32) NOT NULL DEFAULT '',
     8   `lock_type` varchar(32) NOT NULL DEFAULT '',
     9   `lock_table` varchar(1024) NOT NULL DEFAULT '',
    10   `lock_index` varchar(1024) DEFAULT NULL,
    11   `lock_space` bigint(21) unsigned DEFAULT NULL,
    12   `lock_page` bigint(21) unsigned DEFAULT NULL,
    13   `lock_rec` bigint(21) unsigned DEFAULT NULL,
    14   `lock_data` varchar(8192) DEFAULT NULL
    15 ) ENGINE=MEMORY DEFAULT CHARSET=utf8
    16 1 row in set (0.00 sec)
    17 
    18 ERROR:
    19 No query specified
    20 
    21 mysql>
  • 相关阅读:
    如何手动卸载 SQL Server 2005 实例
    马大哈的读后感
    CVS提交0KB的文件失败
    confluence权限管理
    关于confluence注册
    建议使用j2ee自带的ant
    cvs log的几个选项说明(b,r HEAD,n,d)
    JIRA与Confluence的安装与集成(4)
    使用命令行调用Beyond Compare进行文件对比
    利用SecureCRT实现Linux编译
  • 原文地址:https://www.cnblogs.com/igoodful/p/12041405.html
Copyright © 2011-2022 走看看