<p>MySQL throws ER_INVALID_YEAR_COLUMN_LENGTH when a YEAR column is defined with a length other than 4 or without a length in strict SQL modes.</p>
<p>MySQL Error 1818 ER_INVALID_YEAR_COLUMN_LENGTH occurs when a YEAR column is declared with an unsupported length such as YEAR(2). Use YEAR or YEAR(4) to resolve the error.</p>
Supports only YEAR or YEAR(4) column.
The error message "Supports only YEAR or YEAR(4) column" indicates MySQL rejected a table or column definition that specifies an invalid size for the YEAR data type.
MySQL permits only two valid declarations: YEAR and YEAR(4). Any other length, such as YEAR(2), triggers error 1818 with SQLSTATE HY000.
It surfaces during CREATE TABLE, ALTER TABLE, or MODIFY COLUMN statements that attempt to define a YEAR column with an unsupported length.
Developers commonly see it after migrating legacy schemas from older MySQL versions that once allowed YEAR(2).
Older scripts still declare YEAR(2) even though support was removed in MySQL 5.7 and higher.
Typos or generator tools may output YEAR(1) or YEAR(3), instantly violating datatype rules.
In strict SQL mode, leaving off the length in YEAR() can be interpreted as invalid instead of defaulting to YEAR(4).
Raised when using an unsupported feature such as FULLTEXT on an InnoDB table in old versions.
Generic syntax error triggered by malformed SQL, distinct from datatype length issues.
Occurs when a specified collation is not recognized by the current MySQL server.
No. Year(2) was removed for data consistency. Only YEAR or YEAR(4) are valid.
Yes in most configurations, but declare YEAR(4) explicitly to avoid strict mode errors.
No. Values remain intact because the underlying storage format is unchanged.
Galaxy's schema-aware autocomplete flags invalid YEAR lengths in real time, preventing faulty DDL from running.