mysql 错误代码:1267 Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,....

错误代码: 1267

Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation '='

解决方法:

select * from user where mobile = in_mobile COLLATE utf8_unicode_ci;

#或者

select * from user where mobile COLLATE utf8_unicode_ci= in_mobile;

#也就是 COLLATE utf8_unicode_ci放在等号的哪一边都是可以的

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
回答: 这个错误是由于在操作使用了不同的字符集排序规则导致的。具体来说,错误信息提到了两个不同的字符集排序规则,分别是utf8mb4_general_ciutf8mb4_unicode_ci。这两个排序规则不兼容,所以在使用"="操作符时会出现错误。解决这个问题的方法是统一使用相同的字符集排序规则。可以通过修改表的字符集排序规则来解决这个问题。可以使用以下步骤来修复表的字符集排序规则: 1. 执行步骤1的查询,获取非utf8mb4_general_ci编码的表。 2. 使用步骤1查询到的非utf8mb4_general_ci编码作为where条件,执行步骤2的修正SQL,将对应的表修改为utf8mb4编码。 3. 这样就可以统一使用utf8mb4编码,避免出现不同字符集排序规则导致的错误。\[3\] 希望这个回答对您有帮助。如果您还有其他问题,请随时提问。 #### 引用[.reference_title] - *1* *3* [mysql字段编码不一致导致Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_unicode_...](https://blog.csdn.net/chen417980762/article/details/127068037)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [【MySQL】报错1267 - Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,...](https://blog.csdn.net/weixin_43431218/article/details/131574650)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值