Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '

建数据库时选择的COLLATION 是用在排序,大小比较上。一个字符集有一个或多种collation,并且以_ci(大小写不敏感)、_cs(大小写敏感)或_bin(二元)结束。在做比较时,应该确保两个表的字符排序相同。一般建表的时候不指定,可以走默认的,全是默认的就没什么问题了。


解决方法:

只要修改一下 字符集就可以了, 


1.列出MYSQL支持的所有字符集:

SHOW CHARACTER SET;

Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '_第1张图片

2.当前MYSQL服务器字符集设置

SHOW VARIABLES LIKE 'character_set_%';

Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '_第2张图片

3.当前MYSQL服务器字符集校验设置

SHOW VARIABLES LIKE 'collation_%';

Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '_第3张图片

 

4.显示某数据库字符集设置

右键数据库属性

Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '_第4张图片

5.显示和修改某数据表字符集设置

右键设计表

Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '_第5张图片

6.修改数据库字符集 和字符校验规则

vi   /etc/my.cnf   

添加这两行(有则修改)

character-set-server=utf8
collation_server=utf8_general_ci
 

 


 

你可能感兴趣的:(mysql数据库)