1246
MySQLWARNINGCriticalCharacter SetsHIGH confidence
Column charset implicitly converted
Production Risk
Low — data may be silently converted; verify output after ALTER.
What this means
ER_AUTO_CONVERT (1246, SQLSTATE HY000) is a warning indicating that MySQL automatically converted a column character set during a CREATE TABLE or ALTER TABLE because an explicit CHARACTER SET clause was used with an incompatible collation, requiring implicit conversion.
Why it happens
- 1Specifying a CHARACTER SET that differs from the column default in a way that forces conversion
- 2ALTER TABLE changing the character set of a column with existing data
How to reproduce
trigger — this will error
trigger — this will error
ALTER TABLE t1 MODIFY col1 VARCHAR(100) CHARACTER SET utf8mb4; -- Warning 1246 if conversion is implicit
expected output
Warning (Code 1246): Converting column 'col1' from latin1 to utf8mb4
Fix
Explicitly specify the collation to avoid surprises
Explicitly specify the collation to avoid surprises
ALTER TABLE t1 MODIFY col1 VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
Why this works
Explicit collation prevents implicit conversion and ensures the expected character handling.
Sources
Official documentation ↗
MySQL 8.0 — 1246 ER_AUTO_CONVERT
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev