COLLATION 'utf8_general_ci' is not valid for CHARACTER SET 'utf8mb4'. COLLATION 'utf8_general_ci' is not v ... more
时间: 2023-12-24 17:01:53 浏览: 272
Mysql中的排序规则utf8_unicode_ci、utf8_general_ci的区别总结
I understand that you're encountering an error message related to collation and character set in MySQL. The error message states that the collation 'utf8_general_ci' is not valid for the character set 'utf8mb4'. This error typically occurs when you try to set a collation that is not compatible with the chosen character set.
To resolve this issue, you need to ensure that the collation you choose is compatible with the character set. In this case, since you are using the 'utf8mb4' character set, you should select a collation that is specifically designed for this character set, such as 'utf8mb4_general_ci'.
To change the collation for a table or column, you can use the `ALTER TABLE` or `ALTER COLUMN` statement respectively. Here's an example:
```sql
ALTER TABLE your_table MODIFY your_column VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
```
Make sure to replace 'your_table' and 'your_column' with the actual table and column names in your database.
By setting the correct collation for your character set, you should be able to resolve the error.
阅读全文