Cause: java.sql.SQLException: Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation '='
时间: 2023-10-17 13:29:40 浏览: 116
一个奇怪的SQL异常
该错误是由于在操作中使用了不同的字符集和排序规则导致的。解决这个问题的方法是在创建数据库时直接选择合适的字符集和排序规则。比如,可以使用以下语句创建一个具有正确字符集和排序规则的数据库:
CREATE DATABASE mydb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
这样就能解决错误 Cause: java.sql.SQLException: Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation '='。
此外,你也可以参考一些关于MySQL编码的文章,了解更多关于utf8和utf8mb4以及不同的排序规则的知识。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Cause: java.sql.SQLException: Illegal mix of collations (utf8_german2_ci,IMPLICIT) and (utf8_general](https://blog.csdn.net/konglingna2016/article/details/117266751)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [utf8mb4_general_ci Cause: java.sql.SQLException: Illegal mix of collations (utf8mb4_general_ci,IMPLI](https://blog.csdn.net/CarloPan/article/details/108993277)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文