MySQL Forums
Forum List  »  Portuguese

ERROR 1267 (HY000): Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='
Posted by: Diego Felipe Diego
Date: November 20, 2015 01:16PM

Estou fazendo uma migração de versão de MySQL.
O Servidor atual está com o MySQL 5.0.45 e estou testando o MySQL 5.6 e o MariaDB 10.

Tem uma procedure que não executa no MySQL 5.6, ela retorna esse erro.
ERROR 1267 (HY000): Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='

Inicialmente achei que fosse o SQL_MODE, pois no MySQL 5.0 e no MariaDB estava vazio, e no MySQL 5.6 estava com NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES.
Alterei para vazio também e não funcionou. Já passei por esse problema antes e com o SQL_MODE resolveu, mas dessa vez não.

A parte do do código que da erro é um INSERT ... SELECT que é executado através de uma prepared statements. Já tentei usar CONVERT, CAST, mas nada de funcionar.

Outra coisa que já tentei foi alterar os characterset, e deixar igual ao do MySQL 5.0, mas também não funcionou. Se bem que o charcter set do MariaDb está igual ao do MySQL 5.6 e nele funcionou normalmente.

mysql 5.0> show variables like '%char%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+


mysql 5.6> show variables like '%char%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+


MariaDB [(none)]> show variables like '%char%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.