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. python3----scrapy(笔记)

    import scrapy import sys # import io # sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='gb ...

  2. LINQ to SQL语句(2)Count/Sum/Min/Max/Avg操作符

    使用场景 类似于SQL中的聚合函数,用于统计数据,不延迟.如返回序列中的元素数量.求和.最小值.最大值.求平均值. Count 说明:用于返回集合中元素的个数,返回Int类型,生成SQL语句为SELE ...

  3. Lumen Carbon 日期及时间处理包

    用到过的方法: 获取当前Y-m-d H:i:s Carbon::now()->toDateTimeString() 把 Y-m-d H:i:s 转 Y-m-d Carbon::parse('Y- ...

  4. java并发容器(Map、List、BlockingQueue)具体解释

    Java库本身就有多种线程安全的容器和同步工具,当中同步容器包含两部分:一个是Vector和Hashtable.另外还有JDK1.2中增加的同步包装类.这些类都是由Collections.synchr ...

  5. 剑指 offer set 20 打印出和为 s 的连续正序序列

    题目 100 可以由 9~16, 或者 18 ~ 22 组成 思路 1. 与 Leetcode Container With Most Water 有些类似, 依然是平移题目. 但这道更加复杂 2. ...

  6. JMS和ActiveMQ的关系

    JMS和MQ的关系: JMS是一个用于提供消息服务的技术规范,它制定了在整个消息服务提供过程中的所有数据结构和交互流程.而MQ则是消息队列服务,是面向消息中间件(MOM)的最终实现,是真正的服务提供者 ...

  7. 【BZOJ2049,2631,3282,1180】LCT模板四连A

    好吧我并不想讲LCT 只是贴4个代码~ [BZOJ2049][Sdoi2008]Cave 洞穴勘测 #include <cstdio> #include <cstring> # ...

  8. 02.Elasticsearch入门

        Elasticsearch支持Http类型的Restful风格API请求,需要打开9200端口.Elasticsearch服务会监听两个端口9200和9300,9200提供Http Restf ...

  9. 160518、java中使用百度地图(超级简单)

    第一步:导入如下内容,红色的部分需要申请(个人通过手机号就可以申请) <script type="text/javascript" src="http://api. ...

  10. Sass之二(进阶篇)

    源码链接:http://pan.baidu.com/s/1o8M51hC 1. 数据类型 1.1 Number 数字类型,小数类型,带有像素单位的数字类型,全部都属于Number类型 Number类型 ...