14.7.1 Enabling File Formats

14.7 InnoDB File-Format Management InnoDB 文件-格式管理

14.7.1 Enabling File Formats
14.7.2 Verifying File Format Compatibility
14.7.3 Identifying the File Format in Use
14.7.4 Modifying the File Format

随着InnoDB 的演变,数据文件与之前的InnoDB 版本不兼容有时候需要支持新的特征。

为了帮助管理升级和降级情况的兼容性,以及运行不同版本的MySQL,

InnoDB 使用命名的文件格式。InnoDB 当前支持2种命名方式

1.Antelope 是最原始的InnoDB 文件格式,之前没有命名。它支持紧凑的冗余的行格式 对于InnoDB表

是默认的文件格式在MySQL 5.6来确保最大的兼容性和早期的MySQL版本 不支持Barracuda文件格式

Barracuda 是最新的文件格式,它支持所有的InnoDB行格式包括最新的COMPRESSED and DYNAMIC 行格式。

功能相关的COMPRESSED and DYNAMIC 行格式包括压缩表,off-page storage for long column data,

index key 前缀最多到3072字节

本章节讨论启用文件格式对于新的InnoDB 表,验证MySQL不同版本不同文件格式的兼容性

mysql> show variables like ‘%format%’;
+————————–+——————-+
| Variable_name | Value |
+————————–+——————-+
| binlog_format | MIXED |
| date_format | %Y-%m-%d |
| datetime_format | %Y-%m-%d %H:%i:%s |
| default_week_format | 0 |
| innodb_file_format | Antelope |
| innodb_file_format_check | ON |
| innodb_file_format_max | Antelope |
| time_format | %H:%i:%s |
+————————–+——————-+
8 rows in set (0.00 sec)

14.7.1 Enabling File Formats

innodb_file_format 配置选项定义文件格式 当InnoDB 表是创建为 file_per_table tablespaces.

Antelope is the default innodb_file_format.

排除通过Barracuda 文件的功能支持让你的数据库不能访问到MySQL 5.1和之前的版本,

设置innodb_file_format to Antelope。另外, 你可以关闭innodb_file_per_table 让新表创建在system tablespace.

system tablespace 是存储在原始的Antelope file format.

你可以设置innodb_file_format的值在命令行,当你开启mysqld,或者在选项文件(my.cnf on Unix, my.ini on Windows)

你可以改变它动态的SET GLOBAL语句

mysql> SET GLOBAL innodb_file_format=Barracuda;
Query OK, 0 rows affected (0.00 sec)

注意:ALTER TABLE 操作,重建InnoDB表使用当前的 innodb_file_format setting.

尽管Oracle 推荐使用Barracuda 格式对于新的表 ,在MySQL 5.6 默认的文件格式是Antelope,

最大的兼容性在复制配置包含早期的MySQL 版本

原文地址:https://www.cnblogs.com/hzcya1995/p/13351165.html