排序规则 (utf8_general_ci,IMPLICIT) 和 (utf8_unicode_ci,IMPLICIT) 的非法混合用于 MySQL 存储过程中的操作“=”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9819159/
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 12:40:34  来源:igfitidea点击:

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

mysqlcollation

提问by Nikhil

I checked the database table and found it was in latin1_swedish_ciso i've changed it to utf8_general_cithen I changed the collation from latin1_swedish_cito utf8_general_cifor all the fields.

我检查了数据库表,发现它在里面,latin1_swedish_ci所以我把它改成了,utf8_general_ci然后我把所有字段的排序规则从latin1_swedish_ci改为utf8_general_ci

Still it's giving me the same error.

它仍然给我同样的错误。

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

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

Thanks,

谢谢,

回答by Hituptony

so the answer is simple. It seems you missed the change as stated by MKJ ^^ but the actual syntax to alter your tables looks like this.

所以答案很简单。您似乎错过了 MKJ ^^ 所述的更改,但更改表格的实际语法如下所示。

alter table `dbname`.`tablename` convert to character set utf8 collate utf8_general_ci;

Applied as an individual script or at the end of your create table statement you should be able to relate all related tables back to the same charset

作为单独的脚本或在 create table 语句的末尾应用,您应该能够将所有相关表关联回相同的字符集

回答by alicanozkara

COLLATE utf8_unicode_ci

add to the query end, like this;

添加到查询端,像这样;

SELECT * FROM table COLLATE utf8_unicode_ci;