ERROR 1267 (HY000): Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (latin1_general_ci,IMPLICIT) for operation '='

Today i have encountered a problem when i run a select query after joining two tables i.e "ERROR 1267 (HY000): Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (latin1_general_ci,IMPLICIT) for operation '='" . 
This is happen because the collection type is different of each table.

Solution :

1) - First of all check the collection type of each table by running below query :

SELECT table_schema, table_name, column_name, character_set_name, collation_name

FROM information_schema.columns

WHERE collation_name = 'latin1_general_ci'

ORDER BY table_schema, table_name,ordinal_position;
2) - Second one is update the collection type of that table those collection type is different by running below query :

ALTER TABLE tbl_name CONVERT TO CHARACTER SET latin1 COLLATE 'latin1_swedish_ci';
Don't forget to leave a comment if you like this post.

Happy Coding :)

Post a Comment

Previous Post Next Post