1267: Illegal mix of collations
MySQLWhat does it mean?
In a comparison or combining operation (JOIN, WHERE, UNION, CONCAT), two strings with different collations were combined and MySQL could not determine which collation rules to apply.
Why does it happen?
Usually comparing columns with different character sets/collations (e.g. utf8mb4_general_ci vs. utf8mb4_unicode_ci, or latin1 vs. utf8mb4), or a mismatch between a column and the connection collation. Common when tables/databases were created with different defaults.
How to fix it
Bring both sides of the comparison to the same collation: specify an explicit collation with COLLATE (e.g. col1 = col2 COLLATE utf8mb4_unicode_ci) or use CONVERT(... USING ...). For a permanent fix, convert the affected columns/tables to a single consistent character set and collation. Align the connection collation (collation_connection) as well.
More from this engine
- 3948Loading local data is disabled; this must be enabled on both the client and server sides
- 1075Incorrect table definition; there can be only one auto column and it must be defined as a key
- 1055Expression not in GROUP BY (only_full_group_by)
- 1030Got error N from storage engine
- 1197Multi-statement transaction required more than 'max_binlog_cache_size'
- 1785Statement violates GTID consistency
- 3024Query execution was interrupted, maximum statement execution time exceeded