14.8.1 Enabling File Formats

时间:2023-03-08 23:59:54
14.8.1 Enabling File Formats
14.8 InnoDB File-Format Management

14.8.1 Enabling File Formats
14.8.2 Verifying File Format Compatibility
14.8.3 Identifying the File Format in Use
14.8.4 Modifying the File Format 随着InnoDB的发展, data files 格式 不兼容以前的InnoDB 版本有时候需要支持新的功能。 为了帮助管理通用型在升级和降级情况下的兼容性, 系统运行不同版本的 的MySQL, InnoDB 使用命令文件格式。 InnoDB 当前之处两种文件格式, Antelope and Barracuda. 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 | 1. Antelope(羚羊) 是原始的InnoDB 文件格式, 而之前没有名字。 它支持InnoDB 表的 COMPACT and REDUNDANT row formats 对于InnoDB 表 在MySQL 5.6是默认的 file format 来确保兼容早期版本的Mysql 2.Barracuda(梭鱼)是最新的文件格式, 它支持所有的InnoDB 行格式 包含最新的 COMPRESSED and DYNAMIC row formats. 这个章节讨论启用文件格式对于新的InnoDB 表, 验证不同文件格式的兼容性在不同的MySQL 发布版本 确定文件格式的使用 14.8.1 Enabling File Formats 启用文件格式: mysql> show variables like '%innodb_file_format%';
+--------------------------+----------+
| Variable_name | Value |
+--------------------------+----------+
| innodb_file_format | Antelope |
| innodb_file_format_check | ON |
| innodb_file_format_max | Antelope |
+--------------------------+----------+
3 rows in set (0.00 sec) innodb_file_format 配置选项 定义一个文件格式 用于当InnoDB 表被创建在 file_per_table 表空间 Antelope(羚羊) is the default innodb_file_format. 为了防止Barracuda 文件格式支持的功能的使用, 让你的数据库无法访问MySQL 5.1内建的InnoDB 和之前的版本, 设置 innodb_file_format 为Antelope 另外, 你可以禁用innodb_file_per_table 让新的表创建在system tablespace. system tablespace 是存储在原始的Antelope file format. 你可以设置innodb_file_format 的值在命令行当你启动mysqld的时候, 或者 在选项文件my.cnf. 你也可以动态改变它 通过SET GLOBAL statement. mysql> SET GLOBAL innodb_file_format=Barracuda;
Query OK, 0 rows affected (0.00 sec) 注意: ALTER TABLE 操作重新创建InnoDB 表使用当前的innodb_file_format setting. 尽管Oracle 建议使用Barracuda format 对于新的表,在Mysql 5.6 默认的格式是Antelope 为了最大的兼容性在复制配置包含早期的MySQL 版本。