[ERROR]: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation '='
时间: 2023-10-21 14:23:43 浏览: 94
这个错误是由于表中的字符集不一致所导致的。您可以按照以下步骤来解决这个问题:
1. 首先,您可以查询表中的排序规则来找出不一致的字符集:
```
SELECT table_schema, table_name, column_name, character_set_name, collation_name
FROM information_schema.columns
WHERE collation_name = 'utf8_general_ci'
OR collation_name = 'utf8mb4_general_ci';
```
这个查询将返回具有不一致字符集的表和列的信息。
2. 根据查询结果,您可以使用ALTER TABLE语句来修改表的字符集:
```
ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
```
这将把表的字符集修改为utf8mb4,并使用utf8mb4_general_ci排序规则。
3. 如果您发现有其他不一致的字符集,您可以使用类似的ALTER TABLE语句来修改它们。
通过执行这些步骤,您应该能够解决这个字符集不一致的错误。请记得在执行任何数据库操作之前备份您的数据。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [java.sql.SQLException: Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_0900_ai_](https://blog.csdn.net/gys9895/article/details/128342949)[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%"]
- *3* [mysql:Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT)](https://blog.csdn.net/wxp0624/article/details/109611894)[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 ]
阅读全文