1#
2# MDEV-20228 `mysql_upgrade` fails on every version upgrade: "ERROR 1267 (HY000) at line 7: Illegal mix of collations (utf8mb4_unicode_ci,COERCIBLE) and (utf8mb4_general_ci,COERCIBLE) for operation 'like'"
3#
4SET sql_mode="";
5SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;
6#
7# Changing character_set_client and collation_connection
8# for the VIEW mysql.user to utf8mb4/utf8mb4_unicode_ci,
9# to emulate that mysql.user was created by 'mysqld --bootstrap'
10# using mysqld compiled with
11# -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_unicode_ci
12#
13SELECT CHARACTER_SET_CLIENT, COLLATION_CONNECTION
14FROM INFORMATION_SCHEMA.VIEWS
15WHERE TABLE_SCHEMA='mysql' AND TABLE_NAME='user';
16CHARACTER_SET_CLIENT	COLLATION_CONNECTION
17utf8mb4	utf8mb4_unicode_ci
18# Running mysql_upgrade
19Phase 1/7: Checking and upgrading mysql database
20Processing databases
21mysql
22mysql.column_stats                                 OK
23mysql.columns_priv                                 OK
24mysql.db                                           OK
25mysql.event                                        OK
26mysql.func                                         OK
27mysql.global_priv                                  OK
28mysql.gtid_slave_pos                               OK
29mysql.help_category                                OK
30mysql.help_keyword                                 OK
31mysql.help_relation                                OK
32mysql.help_topic                                   OK
33mysql.index_stats                                  OK
34mysql.innodb_index_stats                           OK
35mysql.innodb_table_stats                           OK
36mysql.plugin                                       OK
37mysql.proc                                         OK
38mysql.procs_priv                                   OK
39mysql.proxies_priv                                 OK
40mysql.roles_mapping                                OK
41mysql.servers                                      OK
42mysql.table_stats                                  OK
43mysql.tables_priv                                  OK
44mysql.time_zone                                    OK
45mysql.time_zone_leap_second                        OK
46mysql.time_zone_name                               OK
47mysql.time_zone_transition                         OK
48mysql.time_zone_transition_type                    OK
49mysql.transaction_registry                         OK
50Phase 2/7: Installing used storage engines... Skipped
51Phase 3/7: Fixing views
52mysql.user                                         OK
53Phase 4/7: Running 'mysql_fix_privilege_tables'
54Phase 5/7: Fixing table and database names
55Phase 6/7: Checking and upgrading tables
56Processing databases
57information_schema
58mtr
59mtr.global_suppressions                            OK
60mtr.test_suppressions                              OK
61performance_schema
62test
63Phase 7/7: Running 'FLUSH PRIVILEGES'
64OK
65#
66# Restoring character_set_client and collation_connection back
67# so post-check returns the expected check-mysqld_1.result
68#
69SET NAMES latin1;
70