Mysql编码引起的Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT)错误
来源:互联网 发布:pdf提取软件 编辑:程序博客网 时间:2024/05/21 14:08
前几天写了个Mysql存储过程,在本地环境能执行成功,但是Linux服务器里却报:
Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT)错误。
让我很无解,我对比了这个错误相关的两张表的编码,发现字符序collation都是utf8_unicode_ci,就连两表的连接查询的字段也同样是utf8_unicode_ci。
我再检查了下数据库的编码,一样是 CHARSET=utf8 COLLATE=utf8_unicode_ci,所以执行存储过程报这个Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT)错误让人很无解。
后来想起是不是Mysql的编码和库、表里的不一致,用命令看了下
mysql> show variables where Variable_name like 'collation%';
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_unicode_ci |
+----------------------+-----------------+
里面的collation有不一致,而mysql5.5默认的collation为utf8_general_ci,查看服务器的my.cnf文件有配置
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
character-set-server=utf8
可能是存储过程执行中创建临时表时collation用的是utf8_general_ci,造成创建临时表和实际的两张表字段collation不匹配才报的这个错误,那么要真是这样的话,就得配置my.cnf让Mysql和我们的表的collation一样,就可以了。
于是在my.cnf文件中修改成这样:
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
character-set-server=utf8
collation_server=utf8_general_ci
重启Mysql,再把存储过程中的两张表和字段全部使用utf8_general_ci,然后把数据库也设置成utf8_general_ci,再执行存储过程,OK!可以运行了
- Mysql编码引起的Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT)错误
- Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT)
- MYSQL莫名的 illegal mix of collations( utf8_unicode_ci, IMPLICIT) and (utf8_general_ci)
- Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLIC )
- Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLIC )
- Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLIC
- Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLIC
- mysql错误提示Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE)的一个解决办法
- mysql错误提示Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE)的一个解决办法
- Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=
- Error Code: 1267. Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT
- Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '
- 处理【Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operatio】
- Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '
- Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=
- Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=
- Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=
- Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLIC神级解决方案
- Android中OnScrollListener的详解
- hiho一下 连通性二·边的双连通分量
- Exynos4412 Android4.4 HDMI Porting Guid 第一篇
- cookies的赋值与取值
- 判断链表中是否有环存在
- Mysql编码引起的Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT)错误
- 使用libcurl库把域名转化IP
- 2012年5月SAT香港真题解析
- POJ 2269 Friends(模拟)
- Swift开发--Storyboard的使用教程
- 高斯消元法求解线性方程组
- Java设计模式之命令模式
- js实现图片自动轮播
- iOS 进度条,可选择环形或者直线,有无动画