排序规则的非法混合 MySQL 错误 [英] Illegal mix of collations MySQL Error

查看:40
本文介绍了排序规则的非法混合 MySQL 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在处理大量数据时遇到这个奇怪的错误...

I'm getting this strange error while processing a large number of data...

Error Number: 1267

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

SELECT COUNT(*) as num from keywords WHERE campaignId='12' AND LCASE(keyword)='hello again æ˜" ã‹ã‚‰ ã‚ã‚‹ å ´æ‰€'

我该怎么做才能解决这个问题?我可以以某种方式转义字符串以便不会发生此错误,或者我是否需要以某种方式更改我的表编码,如果是这样,我应该将其更改为什么?

What can I do to resolve this? Can I escape the string somehow so this error wouldn't occur, or do I need to change my table encoding somehow, and if so, what should I change it to?

推荐答案

SET collation_connection = 'utf8_general_ci';

然后用于您的数据库

ALTER DATABASE your_database_name CHARACTER SET utf8 COLLATE utf8_general_ci;

ALTER TABLE your_table_name CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;

MySQL 有时会无缘无故地偷偷溜进来.

MySQL sneaks swedish in there sometimes for no sensible reason.

这篇关于排序规则的非法混合 MySQL 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆