創建大表時報此錯誤:
ERROR 1118 (42000): Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
各種度娘及查官方文檔都無結果,后來努力下終於找到解決方法:
[mysqld] port=3306 # 取消行大小限制(8126) innodb_strict_mode=0
在配置文件里面設置此參數就可以了,當然也可以通過SQL命令來修改 set innodb_strict_mode=0;。下面是官方關於此參數解釋:
When innodb_strict_mode
is enabled, InnoDB
returns errors rather than warnings for certain conditions.
Strict mode helps guard against ignored typos and syntax errors in SQL, or other unintended consequences of various combinations of operational modes and SQL statements. When innodb_strict_mode
is enabled, InnoDB
raises error conditions in certain cases, rather than issuing a warning and processing the specified statement (perhaps with unintended behavior). This is analogous to sql_mode
in MySQL, which controls what SQL syntax MySQL accepts, and determines whether it silently ignores errors, or validates input syntax and data values.
The innodb_strict_mode
setting affects the handling of syntax errors for CREATE TABLE
, ALTER TABLE
, CREATE INDEX
, and OPTIMIZE TABLE
statements. innodb_strict_mode
also enables a record size check, so that an INSERT
or UPDATE
never fails due to the record being too large for the selected page size.
Oracle recommends enabling innodb_strict_mode
when using ROW_FORMAT
and KEY_BLOCK_SIZE
clauses in CREATE TABLE
, ALTER TABLE
, and CREATE INDEX
statements. When innodb_strict_mode
is disabled, InnoDB
ignores conflicting clauses and creates the table or index with only a warning in the message log. The resulting table might have different characteristics than intended, such as lack of compression support when attempting to create a compressed table. When innodb_strict_mode
is enabled, such problems generate an immediate error and the table or index is not created.
You can enable or disable innodb_strict_mode
on the command line when starting mysqld
, or in a MySQL configuration file. You can also enable or disable innodb_strict_mode
at runtime with the statement SET [GLOBAL|SESSION] innodb_strict_mode=
, where mode
is either mode
ON
or OFF
. Changing the GLOBAL
setting requires privileges sufficient to set global system variables (see Section 5.1.9.1, “System Variable Privileges”) and affects the operation of all clients that subsequently connect. Any client can change the SESSION
setting for innodb_strict_mode
, and the setting affects only that client.
innodb_strict_mode
is not applicable to general tablespaces. Tablespace management rules for general tablespaces are strictly enforced independently of innodb_strict_mode
. For more information, see Section 13.1.21, “CREATE TABLESPACE Statement”.