This error message is indicating that there is a mismatch between the collation settings of the columns you are trying to compare in your query.

Collation refers to the rules that determine how string comparison and sorting are performed in a database. Each column in a database can have a specific collation assigned to it, which defines the sorting and comparison behavior for that column.

In your case, you are trying to compare two columns that have different collations:

  • utf8mb4_general_ci
  • utf8mb4_0900_ai_ci

The '=' operator is used for equality comparison, but it requires both operands to have the same collation.

To resolve this issue, you have a few options:

  1. Change the collation of one of the columns to match the other. You can alter the column's collation using the ALTER TABLE statement. For example:

    ALTER TABLE your_table MODIFY COLUMN column_name VARCHAR(255) COLLATE utf8mb4_general_ci;

    Replace "your_table" with the name of your table and "column_name" with the name of the column you want to modify.

  2. Convert one of the columns to a common collation in your query. You can use the COLLATE keyword to explicitly specify the collation for one of the columns in the comparison. For example:

    SELECT * FROM your_table WHERE column1 COLLATE utf8mb4_general_ci = column2;

    Replace "your_table", "column1", and "column2" with the appropriate names.

  3. If the columns in question are part of a join condition, you can specify the collation in the ON clause of the join. For example:

    SELECT * FROM table1 INNER JOIN table2 ON table1.column1 COLLATE utf8mb4_general_ci = table2.column2;

    Replace "table1", "column1", "table2", and "column2" with the appropriate names.

Choose the option that best fits your requirements and adjust the collations accordingly

Illegal mix of collations utf8mb4_general_ciIMPLICIT and utf8mb4_0900_ai_ciIMPLICIT for operation =

原文地址: https://www.cveoy.top/t/topic/ijwN 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录