MySQL Error 1264: Out of Range Value for Column
Fix MySQL Error 1264 by checking the column’s numeric range, correcting the input, or safely changing the data type for valid values.
On this page
MySQL Error 1264 (22003, ER_WARN_DATA_OUT_OF_RANGE) means a numeric value is outside the range allowed by its column. The error message names the column and row. See the MySQL 8.4 error reference.
Check the column type and permitted range
Inspect the live table definition before changing the value or schema:
SHOW CREATE TABLE counters\G
For example, TINYINT UNSIGNED accepts values from 0 through 255. With strict SQL mode enabled, this insert fails with Error 1264:
CREATE TABLE counters (
item_count TINYINT UNSIGNED NOT NULL
) ENGINE = InnoDB;
INSERT INTO counters (item_count)
VALUES (256);
ERROR 1264 (22003): Out of range value for column 'item_count' at row 1
Compare the input with the range of the actual type, including whether the column is UNSIGNED. The MySQL integer type reference lists the ranges for TINYINT, SMALLINT, MEDIUMINT, INT, and BIGINT.
Check SQL mode before interpreting the result
The behavior depends on the session’s SQL mode. In strict mode, MySQL rejects an out-of-range value. Without a restrictive mode, it clips the value to the nearest endpoint and reports a warning instead. Check the mode for the connection that ran the statement:
SELECT @@SESSION.sql_mode;
A warning or successful statement does not mean the original value was stored unchanged. Review the affected row and SHOW WARNINGS rather than relying on a clipped result. Do not disable strict mode as a routine fix; doing so can hide invalid input. See MySQL out-of-range handling and SQL modes.
Choose a type that matches the data
If the value is valid for the business domain but does not fit the current column, select a type with enough capacity. Use UNSIGNED only when negative values are invalid for that field. For integral counts, BIGINT may be appropriate; for exact fractional values, consider a suitable DECIMAL precision and scale.
Before altering an existing column, check its current minimum and maximum values and review application code, indexes, and foreign keys that depend on the column. Widening a type can affect storage and related constraints, so plan the migration before applying it to production data.
Error 1264 concerns a value outside a numeric column’s range. If the message says a value is too long for a string column, see MySQL Error 1406. Browse all MySQL error troubleshooting guides.