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

文章目录

一、MYSQL8?二、目前的自定义的数据库表1.报错sql错误

一、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’;

精彩内容

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: