1118
MySQLERRORNotableDDLHIGH confidence

Row size too large (> 8126 bytes for InnoDB default row format)

Production Risk

Medium — DDL fails; existing data is unaffected but schema cannot be changed.

What this means

ER_TOO_BIG_ROWSIZE (1118, SQLSTATE HY000) is raised when the combined size of all fixed-length columns in a table exceeds the maximum row size for the storage engine. For InnoDB with REDUNDANT/COMPACT row format, the limit is approximately 8126 bytes.

Why it happens
  1. 1Many VARCHAR or fixed-length columns whose total exceeds the row size limit
  2. 2Using REDUNDANT or COMPACT row format instead of DYNAMIC or COMPRESSED
  3. 3Very wide tables with many fixed-length columns
How to reproduce
trigger — this will error
trigger — this will error
CREATE TABLE t (
  c1 VARCHAR(500), c2 VARCHAR(500), c3 VARCHAR(500),
  c4 VARCHAR(500), c5 VARCHAR(500), c6 VARCHAR(500),
  c7 VARCHAR(500), c8 VARCHAR(500), c9 VARCHAR(500),
  c10 VARCHAR(500), c11 VARCHAR(500), c12 VARCHAR(500),
  c13 VARCHAR(500), c14 VARCHAR(500), c15 VARCHAR(500),
  c16 VARCHAR(500), c17 VARCHAR(500)
) ROW_FORMAT=COMPACT;

expected output

ERROR 1118 (HY000): 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.

Fix 1

Switch to DYNAMIC or COMPRESSED row format

WHEN InnoDB table with COMPACT or REDUNDANT row format.

Switch to DYNAMIC or COMPRESSED row format
ALTER TABLE t ROW_FORMAT=DYNAMIC;
-- or set globally:
SET GLOBAL innodb_default_row_format=DYNAMIC;

Why this works

DYNAMIC row format stores long VARCHAR/TEXT columns off-page, allowing much larger effective row sizes.

Fix 2

Convert large VARCHAR columns to TEXT

WHEN Row format change is not possible.

Convert large VARCHAR columns to TEXT
ALTER TABLE t MODIFY COLUMN large_col TEXT;

Why this works

TEXT columns are stored off-page in InnoDB by default (in DYNAMIC format), removing them from the inline row size calculation.

What not to do

Silently truncate data to fit within the row size limit

Truncating data silently loses information; fix the schema instead.

Version notes
MySQL 5.7

innodb_default_row_format was introduced with a default of DYNAMIC, making 1118 less common on new tables.

Sources
Official documentation ↗

MySQL 8.0 — 1118 ER_TOO_BIG_ROWSIZE

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MySQL errors