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

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

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...

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...

mysql字符集相关 Illegal mix of collations (gbk_chinese_***) and (gb2312_chinese_***) for operation '

SQl语句中加了IN 后报 Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (gb2312_chinese_ci,IMPLICIT) f...

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

MYSQL错误:Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (gbk_chinese_ci,COERCIBLE) for o...

mysql错误提示Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE)的一个解决办法

mysql 中关于:Error Code: 1267 Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (utf8_general_ci,...

Mysql Illegal mix of collations 的报错

本文只是于本人自己平时工作的笔录,求放过。 业务上出现的一个场景,要把好友表的信息同步到一份到关注表,本想用union的方法重新合并。过程中报如下错误: 报 错: 1267 - Illegal ...

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

原地转:http://www.blogguy.cn/show-654-1.html Error:  Illegal mix of collations (gbk_chinese_ci,IMPLICI...

对 mysql Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (gb2312_chinese_ci,I的解决

对于常见的乱码问题,有的在数据库本身已经为gbk或gb2312时候,但是查询出来却是乱码,这是因为mysql在连接的过程中还有道编码,因此将连接的编码设为gb2312或utf-8 即可,如: jd...

Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLIC

在mysql5中遇到的问题: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT...

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

Error: Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for ope...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

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