java.sql.SQLException: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=',意思是说字符编码不一样,不能进行比较,也就是说数据库内部的编码都不一样,有的数据是latin1_swedish_ci,有的数据是utf8_general_ci,,因此解决此问题的核心就是将数据库所有的编码进行统一。

1、查看数据库编码,使用sql语句:show variables like 'character_set_%';

正确的如下图:

如果编码不对,可使用以下sql语句进行修改:

set character_set_client=utf8;

set character_set_connection=utf8;

set character_set_database=utf8;

set character_set_results=utf8;

set character_set_server=utf8;

set character_set_system=utf8;

2、查看排序规则,使用sql语句:show variables like 'collation_%';

正确的如下图:

如果不对,可使用以下sql语句进行修改:

set collation_connection=utf8;

set collation_database=utf8;

set collation_server=utf8;

java.sql.SQLException: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' 异常处理,及MySQL数据库编码设置的更多相关文章

  1. Django的admin管理系统写入中文出错的解决方法/1267 Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation ‘locate’

    Django的admin管理系统写入中文出错的解决方法 解决错误: 1267  Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and ( ...

  2. Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' 解决方法

    1. 代码 SHOW VARIABLES LIKE 'character_set_%'; 查看一下 显示 +--------------------------+------------------- ...

  3. java.sql.SQLException: Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_0900_ai_ci,IMPLICIT) for operation '='

    查询视图时报错:java.sql.SQLException: Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_ ...

  4. b-is-in- (1267, "Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='") SELECT id FROM qqzoneshuoshuo WHERE words=

    db-is-in- (1267, "Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8_general_ci, ...

  5. 解决Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COER

    今天在用java与mysql数据库时发现Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COER ...

  6. 1267 - Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' | 1267 - Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (Latin,COERCIBL)

    select * FROM information_schema.columns WHERE table_schema = "databaseName" and collation ...

  7. Mysql查询报错:Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='

    使用sql别名关联查询的时候,由于字符集冲突导致该错误 解决方案,查询的时候强制转换字符集类型 case when column = '' then _gbk '' collate gbk_chine ...

  8. Illegal mix of collations (big5_chinese_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'like'

    解释: 非法的混合排序规则(big5_chinese_ci)和(utf8_general_ci)操作“like”. 原本是单个字段查询数据的,现在是把所有的字段用一个搜索框来查询. 主要出问题是下列这 ...

  9. Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci...

    最近刚接触mysql,今天用mysql插入中文字符的时候,程序报错“Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_g ...

随机推荐

  1. TCP/IP 在 Windows 下的实现

    Windows 实现TCP/IP 协议也是建立在上一篇博客的OSI 基础之上的. 用户态是由ws2_32.dll 和一些其他服务提供者的 dll 共同实现,当中ws2_32.dll 是一个框架.能够容 ...

  2. Effective C++ Item 9 Never call virtual functions during constrution or destruction

    Because such calls would never go to a more derived class than that of currently executing construto ...

  3. MemSQL start[c]up Round 1.E

    完全的乱搞题啊... 被坑的要死. 拿到题目就觉得是规律题加构造题, 然后找了了几个小时无果,只知道n为奇数的时候是一定无解的,然后当n为偶数的时候可能有很多解,但是如果乱选择的话,很有可能形成无解的 ...

  4. android中Animation动画的连续播放与播放完毕后停留在最后的状态

    我们做安卓应用的苦逼程序员们常常会需要用到Animation也就是动画.比如做地图功能的时候.我们在手机旋转时需要根据手机重力感应来调整地图的角度,让它上面的“北”一直指向地球的北面...好多人做动画 ...

  5. 浏览器中使用 ES6 import

    html 中的 head 标签引入: <script src="test.js" type="module"></script> tes ...

  6. web安全之xss攻击

    xss攻击的全称是Cross-Site Scripting (XSS)攻击,是一种注入式攻击.基本的做法是把恶意代码注入到目标网站.由于浏览器在打开目标网站的时候并不知道哪些脚本是恶意的,所以浏览器会 ...

  7. CentOS7部署Haproxy 1.7.2

    一.环境准备 1.操作系统 CentOS-7-x86_64-1611 2.Haproxy版本1.7.2 3.Haproxy服务器IP 192.168.186.131.web1服务器安装并启动Nginx ...

  8. DocumentRoot \

    w  有无\的区别. https://httpd.apache.org/docs/2.4/vhosts/examples.html hosts 127.0.0.1 w.w httpd.conf Ser ...

  9. Browser Cookie Limits

    w https://cait.calarts.edu/hc/en-us/articles/217055138-Error-Maximum-Number-of-Cookie-Values-Reached ...

  10. Laravel 5.x HTTPS反向代理的实现

    需求 可针对多个域名设置HTTPS并指向到同一个项目. 最先考虑到的是通过nginx的反向代理来实现,最终测试发现效果并不完美. 示例如下: server { listen 127.0.0.1:808 ...