java.sql.SQLException: Illegal mix of collations

原创 2012年03月26日 16:45:41
  java.sql.SQLException: Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)

        这是字符集的问题
  首先、查看mysql的my.cnf,确认为utf8
  mysql> show   variables   like   "%char%";
  +--------------------------+----------------------------+
  | Variable_name          | Value                          |
  +--------------------------+----------------------------+
  | character_set_client     | utf8                         |
  | character_set_connection | utf8                    |
  | character_set_database   | utf8                    |
  | character_set_filesystem | binary                  |
  | character_set_results    | utf8                       |
  | character_set_server     | utf8                       |
  | character_set_system     | utf8                      |
  | character_sets_dir       | /usr/share/mysql/charsets/ |
  +--------------------------+----------------------------+
  mysql> show   variables   like   "%coll%";
  +----------------------+-----------------+
  | Variable_name        | Value           |
  +----------------------+-----------------+
  | collation_connection | utf8_general_ci |
  | collation_database   | utf8_general_ci |
  | collation_server     | utf8_general_ci |
  +----------------------+-----------------+
  二、查看表以及字段的的字符集是否为utf8

         解决办法:

        主要mysql编码碰到了问题,这里建议将mysql数据库的中文编码修改为utf8(所有地方)。
  1)将mysql安装目录下的my.ini编码都修改为utf8
  2)新建数据库时,选用utf8编码
  3)新建varchar列时选用utf8编码,
  保证解决编码问题!
  ----------
  常用命令备忘
  SHOW VARIABLES LIKE 'character_set_%';
  SHOW VARIABLES LIKE 'collation_%';
  SET collation_server = gb2312_chinese_ci
  set names = utf8

MySQL的Illegal mix of collationsy异常原因和解决方法

 今天在使用数据库临时表的游标时,发现了这个异常。经查找资料,最终结果。这里和大家分享一下。 字符集问题还是一定要统一的才是最简单的。create temporary table temp2(mc1 ...

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.*, getEqu...

Mysql编码引起的Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT)错误

前几天写了个Mysql存储过程,在本地环境能执行成功,但是Linux服务器里却报: Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (...

MySQL数据库字符集引发存储过程【Illegal mix of collations】问题总结

MySQL数据库字符集 1.1.1  MySQL字符集情况介绍 I. 字符集 字符值包含字母、数字和特殊符号。在字符值可以存储之前,字母、数字和字符必须转换为数值代码。所以必须建立一个转换表,其中包含...

Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COER) 解决办法

在向mysql 插入中文的过程中,系统报错: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,...

java.sql.SQLException: Illegal mix of collations (gb2312_chinese_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '=

java.sql.SQLException: Illegal mix of collations (gb2312_chinese_ci,IMPLICIT) and (latin1_swedish_ci...

Mybatis学习中遇到的错误java.sql.SQLException: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (ut

在Mybatis学习存储过程调用的时候,老是出现【java.sql.SQLException: Illegal mix of collations (latin1_swedish_ci,IMPLICI...

java.sql.SQLException: Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='

在操作MYsql数据库时,报“ SQL state [HY000]; error code [1267]; Illegal mix of collations (gbk_chinese_ci,IMPL...

关于mysql错误:Illegal mix of collations for operation '='的解决

Error: Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for ope...

mybatis中Illegal mix of collations for operation 'like' 错误解决方法

zen cart 订单搜索功能,使用中文关键字搜索,出现 Illegal mix of collations for operation 'like' 错误解决方法2013-07-03 11:52:3...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:java.sql.SQLException: Illegal mix of collations
举报原因:
原因补充:

(最多只允许输入30个字)