Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_0900_ai_ci,IMPLICIT) for operat

提示:Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_0900_ai_ci,IMPLICIT) for operation ‘find_in_set’


一、MYSQL8?

默认的排序规则:utf8mb4_0900_ai_ci

二、目前的自定义的数据库表

utf8mb4_general_ci

1.报错sql

代码如下(示例):

SELECT
 id,
 #level,
 CODE,
 parent_id,
NAME 
FROM
 (
 SELECT
  t1.*,
 IF
  ( FIND_IN_SET( parent_id, @pids ) > 0, @pids := CONCAT( @pids, ',', id ), '0' ) AS ischild 
 FROM
  ( SELECT * FROM auth_organization AS t WHERE t.STATUS = '1' ) t1,
  (
  SELECT
  @pids := 1557259013072052225) t2 
 ) t3 
WHERE
 ischild != '0' UNION
SELECT
 id,
 #level,
 CODE,
 parent_id,
NAME 
FROM
 auth_organization 
WHERE
 id = 1557259013072052225
ORDER BY NAME 
#order by level, name

错误

代码如下(示例):

1267 - Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_0900_ai_ci,IMPLICIT) for operation 'find_in_set'

处理
show variables like ‘%coll%’;
set global collation_connection = ‘utf8mb4_general_ci’;

先执行:
set collation_connection = ‘utf8mb4_general_ci’;


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值