Mysql 报错: `Error 1267 Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation ‘=’

1.问题

mysql字符集不匹配导致比较时出错。
这种问题可能出现在Mysql函数,存储过程运行时

2.原因

使用的mysql的字符集与表中字段的字符集不一致。
这里的utf8mb4_unicode_ci和utf8mb4_general_ci是两种字符集排序方式。【其中的c指的就是Collation:排序规则

3.解决方法

  • 在使用的varchar 类型字段中添加字符排序方式:select * from user where mobile = in_mobile COLLATE utf8_unicode_ci;
  • 或者直接修改my.cnf文件,在[mysqld]中添加默认的字符集排序方式
[mysqld]
character-set-server=utf8
collation-server=utf8mb4_general_ci[###或者是utf8mb4_unicode_ci]

参考链接

  • https://dev.mysql.com/doc/refman/5.7/en/charset-applications.html

Error 1267 Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT相关推荐

  1. Error 1267 Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT)

    @[TOC](Error 1267 Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IM ...

  2. mysql general error,mysql General error: 1267 Illegal mix of collations错误​

    在项目迁移之后一个视图的访问出现了问题,报了mysql的1267错误,具体报错信息就是 SQLSTATE[HY000]: General error: 1267 Illegal mix of coll ...

  3. MySQL:Illegal mix of collations (utf8_general_ci,COERCIBLE) and (gbk_chinese_ci,IMPLICIT) for operat

    MySQL:Illegal mix of collations (utf8_general_ci,COERCIBLE) and (gbk_chinese_ci,IMPLICIT) for operat ...

  4. Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci

    在进行表关联查询,特别是跨库时,特别容易报这个错,原因是关联的两张表对应的排序规则不一致. 在navicate中右键表,查看对象信息 在join时,添加COLLATE属性,比如a表关联b表,a表的排序 ...

  5. Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_0900_ai_ci,IMPLICIT) for operat

    今天在做一个左链接的时候遇到这个问题,网上很多网人说修改表的编码什么的也都试了,但是问题变化接二连三,问题记录如下: select t.card_num,t.uid,tt.business,ttt.n ...

  6. Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operat

    原因:两张表有不同的排序规则 一个排序规则是默认是utf8mb4_unicode_ci,另一张表的排序规则是utf8mb4_general_ci,它说您在操作中使用了非法的排序规则组合=. 解决方法: ...

  7. 1267 'Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_gener

    这个错误是在使用django框架的时候,一次偶然间没有设置数据库的字符集为utf8,导致的问题. 还好是刚开始所以就重新创建了一下数据库指定字符集为utf8就好了

  8. Illegal mix of collations (XXX) and (XXX) for operation ‘XXX’

    问题描述: mybatis使用INSTR的时候报错(数据库为MySQL)-- Illegal mix of collations (XXX) and (XXX) for operation 'XXX' ...

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

    问题描述:MySQL进行字符串比较时发生错误: SELECT a.equ_no, b.fullCode FROM equipment a, ( SELECT t.*, getEquTypeFullCo ...

最新文章

  1. IDEA IntelliJ 如何设置网站的欢迎页面
  2. sql实现random sample_web验证码的简单实现
  3. vc++ 6.0下Glut的配置 及 Glut 框架介绍
  4. [trustzone]-ARM Core的扩展和ELx级别的切换过程
  5. 对不起,我就是喜欢问你Spring构造器注入原理
  6. LiveVideoStack线上分享第三季(二):对话机器人与儿童电子消费品
  7. 花点时间了解消息,句柄和窗口
  8. 【iVX 初级工程师培训教程 10篇文拿证】04 画布及我和 iVX 合照
  9. moreunit_MoreUnit与MoreUnit
  10. 2019年的wps计算机考试题,2019年3月计算机一级WPS模拟题及答案(2.21)
  11. Js获取短信验证码前段效果
  12. 【CCF】201609-2火车购票
  13. javaweb项目自动设置热加载
  14. Ubuntu安装RabbitMQ及RabbitMQ基于使用
  15. 手机APP游戏/软件/资源下载站/软件盒子源码
  16. 百战程序员python资源_Python【北京尚学堂·百战程序员】
  17. 由114.114.114.114和8.8.8.8学习DNS
  18. 爬虫(一):爬虫的基础知识 ---通用爬虫和聚焦爬虫,http和https协议,常见的响应状态码
  19. 经典算法题——最长公共子序列
  20. SQL语句,数据库增加、删除、修改、查询

热门文章

  1. C++ cout输出小数位数
  2. 解决svn提交时出现Commit failed with error svn:E720003 的问题
  3. 苹果6手机怎么录屏_苹果手机如何开启录屏功能 苹果手机开启录屏功能方法【详解】...
  4. JSR303校验之@NotEmpty注解
  5. 2023软件测试金三银四常见的软件测试面试题-【接口测试】
  6. AI绘制毛线的小技巧
  7. 黄彦达:51.com的网络营销模式
  8. APIspace各类接口推荐
  9. 刷脸支付是一场「向后看 5 年」的战争
  10. lua延时函数c语言,C语言拓展实现Lua sleep函数