Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '='

前端 未结 8 1387
一向
一向 2020-11-28 21:36

Error message on MySql:

Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation \'=\'

I have gone

8条回答
  •  旧时难觅i
    2020-11-28 21:58

    This happens where a column is explicitly set to a different collation or the default collation is different in the table queried.

    if you have many tables you want to change collation on run this query:

    select concat('ALTER TABLE ', t.table_name , ' CONVERT TO CHARACTER 
    SET utf8 COLLATE utf8_unicode_ci;') from (SELECT table_name FROM 
    information_schema.tables where table_schema='SCHRMA') t;
    

    this will output the queries needed to convert all the tables to use the correct collation per column

提交回复
热议问题