MySQL 非法混合排序规则 (utf8_unicode_ci,IMPLICIT) 和 (utf8_general_ci,IMPLICIT) 用于操作 '='

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/995789/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 13:30:17  来源:igfitidea点击:

MySQL Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '='

mysqlcollation

提问by MySQL DBA

I need your help in identifying why this error is coming

我需要你的帮助来确定为什么会出现这个错误

Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '='

The procedure was working fine till yesterday and today it started giving error of illegal mix of collations. I checked each and every table of my database and all the tables and its columns are in one charset and collation that is:- utf8 utf8_unicode_ci.

该程序直到昨天都运行良好,今天它开始出现非法混合校对的错误。我检查了数据库中的每一个表,所有表及其列都在一个字符集和排序规则中,即:- utf8 utf8_unicode_ci。

I created another schema with same structrue and tried to execute same query it works fine but not on its original schema.

我创建了另一个具有相同结构的模式,并尝试执行相同的查询,它工作正常,但不是在其原始模式上。

can anyone provide any input on this? Why is so happening ?

任何人都可以提供任何意见吗?为什么会这样?

回答by Radmilo

I've had same problem, and i discovered that tables had same collation, but columns did not. You could download mysqlyog trial and in alter table uncheck hide language options.... Quickest way to see.

我遇到了同样的问题,我发现表有相同的排序规则,但列没有。您可以下载 mysqlyog 试用版并在更改表中取消选中隐藏语言选项.... 最快的查看方式。

回答by meriu

in my case it was due to stupid mysql workbench - it somehow adds to procedure default collation from schema (to some metadata or what) and then if you collate anything in procedure to different collation, this exception occurs;

在我的情况下,这是由于愚蠢的 mysql 工作台 - 它以某种方式从模式(到某些元数据或什么)添加到过程默认排序规则,然后如果您将过程中的任何内容整理到不同的排序规则,就会发生此异常;

must set correct (the one which is used in procedure) collation to schema and then to re-edit the procedure and apply changes (must be resaved or recreated) and everything is ok now

必须将正确的(在程序中使用的)排序规则设置为模式,然后重新编辑程序并应用更改(必须重新保存或重新创建),现在一切正常

回答by user1644564

Each parameter of the concat function needs to be converted.

concat 函数的每个参数都需要转换。

CONCAT(CONVERT(field_A USING utf32), CONVERT(field_B USING utf32))

Or which ever function your having a problem with.

或者您遇到问题的功能。

回答by Michal - wereda-net

my problem was the same, but In my case sufficient was using conversion before using sql statement - in php

我的问题是一样的,但在我的情况下,在使用 sql 语句之前使用转换就足够了 - 在 php 中

iconv(...)