• 14.5.1 Creating InnoDB Tables


    14.5 InnoDB Table Management  InnoDB 表管理
    
    14.5.1 Creating InnoDB Tables
    14.5.2 Moving or Copying InnoDB Tables to Another Machine
    14.5.3 Grouping DML Operations with Transactions
    14.5.4 Converting Tables from MyISAM to InnoDB
    14.5.5 AUTO_INCREMENT Handling in InnoDB
    14.5.6 InnoDB and FOREIGN KEY Constraints
    14.5.7 Limits on InnoDB Tables
    
    
    14.5.1 Creating InnoDB Tables
    
    
    创建一个InnoDB 表, 使用CREATE TABLE 语句。你不需要指定ENGINE=InnoDB子句 如果InnoDB 是定义为默认的存储引擎,
    
    
    MySQL 5.5默认是InnoDB. 你仍旧可以使用ENGINE=InnoDB 子句如果你计划使用mysqldump 或者负载来
    
    复制 CREATE TABLE 语句在server上 ,此server不是innodb作为默认引擎。
    
    
    -- Default storage engine = InnoDB.
    CREATE TABLE t1 (a INT, b CHAR (20), PRIMARY KEY (a));
    
    -- Backward-compatible with older MySQL.
    CREATE TABLE t2 (a INT, b CHAR (20), PRIMARY KEY (a)) ENGINE=InnoDB;
    
    
    一个InnoDB 表和它的indexes 可以创建在系统表空间或者 在一个file-per-table tablespace.
    
    当 innodb_file_per_table问及被启用,  在MySQL 5.6.6 里是默认设置,
    
    
    一个InnoDB 表是隐式的创建的 在一个单独的 file-per-table tablespace.
    
    
    相反,当innodb_file_per_table 被禁言,一个InnoDB 表是隐式的创建在system 表空间。
    
    
    当你创建一个MySQL Innodb 表, MySQL创建一个.frm 文件在数据库目录在MySQL 数据目录。
    
    
    对于表创建在 file-per-table tablespace,一个.ibd 文件也会被创建.
    
    
     一个表创建在system 表空间是被创建在存在的system表空间ibdata files.
    
    
    在内部,InnoDB 增加一个entry 对于每个表到InnoDB 数据目录。
    
    
    entry 包括数据库名字。比如, 如果表t1 是创建在test数据库,数据字典条目是"test/t1".
    
    
    这意味着 你可以创建一个相同的表在不同的数据库
    
    Viewing the Properties of InnoDB Tables
    
    To view the properties of InnoDB tables, issue a SHOW TABLE STATUS statement:
    
    mysql> SHOW TABLE STATUS FROM test LIKE 't%' G;
    *************************** 1. row ***************************
               Name: t1
             Engine: InnoDB
            Version: 10
         Row_format: Compact
               Rows: 0
     Avg_row_length: 0
        Data_length: 16384
    Max_data_length: 0
       Index_length: 0
          Data_free: 0
     Auto_increment: NULL
        Create_time: 2015-03-16 16:26:52
        Update_time: NULL
         Check_time: NULL
          Collation: latin1_swedish_ci
           Checksum: NULL
     Create_options: 
            Comment: 
    1 row in set (0.00 sec
    
    mysql> SHOW TABLE STATUS FROM zjzc LIKE '%ClientActionTrack%' G;
    *************************** 1. row ***************************
               Name: ClientActionTrack
             Engine: InnoDB
            Version: 10
         Row_format: Compact
               Rows: 259238
     Avg_row_length: 620
        Data_length: 160907264
    Max_data_length: 0
       Index_length: 0
          Data_free: 145752064
     Auto_increment: 302754
        Create_time: NULL
        Update_time: NULL
         Check_time: NULL
          Collation: utf8_general_ci
           Checksum: NULL
     Create_options: partitioned
            Comment: 用户访问记录表
    1 row in set (0.01 sec)
    
    ERROR: 
    No query specified
    
    在状态输出懒,你看到表t1的Row格式属性是compact.
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

  • 相关阅读:
    二维材料根本停不下来
    So you've been rejected, now what? On appeals in peer-reviewed publications(From Wiley Exchanges)
    Android与服务器端数据交互(基于SOAP协议整合android+webservice)
    SOAP
    soap webservice
    WebService
    Restful Web Service初识
    Java IO 类
    就是这个味道!!!
    windows下taskkill命令简介
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13351175.html
Copyright © 2020-2023  润新知