前日做一台新机器上运行项目时,一做数据库操作就出现如下异常:
Hibernate operation: could not execute query; uncategorized SQLException for
SQL [select tuser0_.tu_id as tu1_, tuser0_.to_id as to2_51_, tuser0_.login_name as login3_51_, tuser0_.password as passwo
rd51_, tuser0_.username as username51_, tuser0_.mobile as mobile51_, tuser0_.email as email51_, tuser0_.gen_time as gen8
_51_, tuser0_.login_time as login9_51_, tuser0_.last_login_time as last10_51_, tuser0_.count as count51_, tuser0_.mailfl
ag as mailflag51_, tuser0_.smsflag as smsflag51_ from tuser tuser0_ where tuser0_.login_name=?]; SQL state [HY000]; erro
r code [1267]; Illegal mix of collations (gb2312_chinese_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '=
';
nested exception is java.sql.SQLException: Illegal mix of collations (gb2312_chinese_ci,IMPLICIT) and (latin1_swedish
_ci,COERCIBLE) for operation '='

解决方法:
将 Mysql 的 my.ini 文件[mysqld] 段字符集修改为gb2312

default-character-set=gb2312