mariadb/mysql-test/std_data/upgrade
Alexander Barkov ae5c8bfe76 MDEV-38698 mysql_upgrade does not fix charset and collation for mysql.user
In case if the view mysql.user was created (e.g. in 10.6) with a
pre- 18edb0959f server with an unexpected
character_set_client or collation_connection, e.g.
utf8mb3 and utf8mb3_general_ci, mysql_upgrade did not fix it to the
expected latin1 and latin1_swedish_ci.

Since 11.8 this could often lead to "Illegax mix of collations" errors
when querying mysql.user, because since 11.8 the default collation for
utf8mb3 is utf8mb3_uca1400_ai_ci, according to the default
@@character_set_collations. For consistency, it's better to fix the
problem starting from 11.4.

For example:

MariaDB [test]> select user,host,is_role from
    -> mysql.user where is_role='N';
ERROR 1267 (HY000): Illegal mix of collations (utf8mb3_general_ci,COERCIBLE)
                    and (utf8mb3_uca1400_ai_ci,COERCIBLE) for operation '='

Fixing mariadb_system_tables_fix.sql to drop the view if it has non-standard
character set or collations, so it gets recreated again correctly by
the CREATE statement in mariadb_system_tables.sql
2026-02-02 09:42:23 +04:00
..
user-100625-utf8mb3.frm MDEV-38698 mysql_upgrade does not fix charset and collation for mysql.user 2026-02-02 09:42:23 +04:00