解决Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (gbk_chinese_ci,COERCIBLE) for operatio

进入MySQL,分别查看rejectprj和reviewprj两个表的结构,通过show full columns from <table>,查看其Collation,如下图

解决Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (gbk_chinese_ci,COERCIBLE) for operatio

其中reviewprj的fhbh为gbk_chinese_ci,而rejectprj的fhbh为latin1_swedish_ci,所以当两表通过fhbh关联时,就会出现以上错误。

 则通过以下命令将rejectprj的fhbh的Collation更改为gbk_chinese_ci。

mysql>alter table rejectprj changecolumn fhbh fhbh varchar(20) character set 'gbk_chinese_ci';

 这样修改后,执行以上SQL命令不会出错了。

alter table tablename convert to character set GBK。

tablename = 你的表的名称