Illegal mix of collations for operation 'concat'
在t_employee表中,练习使用concat函数连接字符串时,
mysql> select concat('工号为:',fnumber,'的员工的幸福指数:',fsalary/(fage-21))
-> from t_employee;
1271 - Illegal mix of collations for operation 'concat' 报错
在网上查看了相关错误文章发现是字段得字符集有问题,我这里的fnumber字段的字符集是latin1,而字段操作默认为UTF8的编码。 绝对统一使用UTF-8 。
修改了字符集为utf-8后再次运行SQL命令
mysql> select concat('工号为:',fnumber,'的员工的幸福指数:',fsalary/(fage-21))
-> from t_employee;
+-----------------------------------------------------------------+
| concat('工号为:',fnumber,'的员工的幸福指数:',fsalary/(fage-21)) |
+-----------------------------------------------------------------+
| 工号为:dev001的员工的幸福指数:2075.000000 |
| 工号为:dev002的员工的幸福指数:328.685714 |
| 工号为:HR001的员工的幸福指数:1100.400000 |
| 工号为:HR002的员工的幸福指数:1300.090000 |
| 工号为:IT001的员工的幸福指数:557.142857 |
| 工号为:IT002的员工的幸福指数:466.666667 |
| 工号为:sales001的员工的幸福指数:2500.000000 |
| 工号为:sales002的员工的幸福指数:885.714286 |
| 工号为:sales003的员工的幸福指数:1200.000000 |
+-----------------------------------------------------------------+
9 rows in set
搜索出来的数据是正确的,没有报错。
Illegal mix of collations for operation 'concat'的更多相关文章
- mysql5.6修改字符编码,ERR:Illegal mix of collations for operation 'concat'
mysql5.6修改字符编码,ERR:Illegal mix of collations for operation 'concat' 1.问题起因:搭建环境初始化mysql的时候看到mysql配置文 ...
- MySQL Error: Illegal mix of collations for operation 'concat'
在使用concat连接字符串时出现错误:MySQL Error: Illegal mix of collations for operation 'concat' 原因:字段操作默认为UTF8的编码, ...
- Illegal mix of collations for operation 'like' while searching with Ignited-Datatables
Stack Overflow Questions Developer Jobs Tags Users Log In Sign Up Join Stack Overflow to learn, sh ...
- mysql 客户端连接报错Illegal mix of collations for operation
服务端用的是utf-8,客户端工具打开表和视图是会报Illegal mix of collations for operation错误,经排查,可以采用以下语句解决 SET character_set ...
- 错误之Illegal mix of collations for operation 'like'
内容来自博客:https://www.cnblogs.com/install/p/4417527.html MySQL Illegal mix of collations for operation ...
- myslq数据库用union all查询出现 #1271 - Illegal mix of collations for operation 'UNION'
出现 #1271 - Illegal mix of collations for operation 'UNION' 的原因是两个字符编码不匹配造成的. 我遇到的是 utf8_general_ci ...
- mysql提示:Illegal mix of collations for operation ‘UNION’
http://www.111cn.net/database/mysql/56096.htm show variables like "%char%"; show variables ...
- 有关mysql的utf8和utf8mb4,以及Illegal mix of collations for operation 'like'
参考以下几个帖子: https://www.cnblogs.com/install/p/4417527.html https://blog.csdn.net/Yetmoon/article/detai ...
- Mysql Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '='
MySQL字符串比较bug: select * from table_a a left join table_b b on a.field_a = b.field_b error: Illegal ...
随机推荐
- DataFrame在算术方法中填充值
在对不同索引的对象进行算术运算时, 你可能希望当一个对象中某个轴标签在另一个对象中找不到时填充一个特殊值(比如0)
- [转]浅谈Android五大布局(一)——LinearLayout、FrameLayout和AbsoulteLayout
Android的界面是有布局和组件协同完成的,布局好比是建筑里的框架,而组件则相当于建筑里的砖瓦.组件按照布局的要求依次排列,就组成了用户所看见的界面.Android的五大布局分别是LinearLay ...
- QWSLock::up(): Invalid argument
运行qt时,点击QMessageBox的确定按钮是出现错误QWSLock::up(): Invalid argument, QWSLock::down(): Invalid argument,这个是q ...
- Maven是一个项目管理工具
Maven是一个项目管理工具,它包含了一个项目对象模型 (Project Object Model),一组标准集合,一个项目生命周期(Project Lifecycle),一个依赖管理系统(Depen ...
- Asp.Net MVC :路由器
特性路由 特性路由是对现有路由系统的扩展,提供了一种针对某个具体Controller类型或Action方法的路由注册方式.从而可以对路由规则进行细粒度的设计. 特性路由(Attribute Route ...
- Java获取正在执行的函数名
利用StackTrace堆栈轨迹获取某个时间的调用堆栈状态. package com.dsp.demo; public class TechDemo { public static void main ...
- Linux 查看操作系统版本
在下载软件的时候,需要知道操作系统对应的版本,通过 cat /etc/issue 可以查看对应信息 运行的结果如下: CentOS release 6.7 (Final) Kernel \r on a ...
- Spring核心框架体系结构(jar包引用分析)[转]
很多人都在用spring开发java项目,普通添加lib目录拷贝jar包,或者创建maven项目时,配置maven依赖的时候并不能明确要配置哪些spring的jar,经常是胡乱添加一堆,编译或运行报错 ...
- php-fpm的pool php-fpm慢执行日志 open_basedir php-fpm进程管理
php-fpm的pool • vim /usr/local/php/etc/php-fpm.conf//在[global]部分增加 • include = etc/php-fpm.d/*.conf • ...
- Nginx防盗链 Nginx访问控制 Nginx解析php相关配置 Nginx代理