MySQL 8 不会在日志文件中的 "Data dictionary upgrading" 之后启动

MySQL 8 won't start after "Data dictionary upgrading" in log file

我是 运行 MySQL 8 岁,当我尝试重新启动它时,它突然决定关机并且不再回来。

在日志中我可以看到这个事件是原因。

但是,我不知道那是什么意思?或者为什么会突然发生这种情况?

2019-04-25T06:36:58.622078Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 86  user: 'root'.
2019-04-25T06:37:01.363106Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.15)  MySQL Community Server - GPL.
2019-04-25T06:37:04.074285Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.16) starting as process 26628
2019-04-25T06:37:04.077268Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2019-04-25T06:37:04.077300Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_unicode_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
2019-04-25T06:37:04.084875Z 0 [Warning] [MY-012363] [InnoDB] innodb-page-size has been changed from the default value 16384 to 65536.
2019-04-25T06:37:14.212106Z 1 [System] [MY-011090] [Server] Data dictionary upgrading from version '80014' to '80016'.
2019-04-25T06:37:15.910395Z 1 [ERROR] [MY-013178] [Server] Execution of server-side SQL statement 'UPDATE mysql.index_partitions ip JOIN mysql.tablespaces ts ON ts.id = ip.tablespace_id JOIN mysql.table_partitions p ON p.id = ip.partition_id JOIN mysql.tables t ON t.id = p.table_id JOIN mysql.indexes i ON i.table_id = t.id SET ts.options=CONCAT(IFNULL(ts.options,''), IF(LOWER(GET_DD_PROPERTY_KEY_VALUE(t.options,'encrypt_type'))='y' , 'encryption=Y;','encryption=N;')) WHERE t.tablespace_id IS NULL AND i.tablespace_id IS NULL AND p.tablespace_id IS NULL AND ts.engine='InnoDB' AND GET_DD_PROPERTY_KEY_VALUE(t.options,'encrypt_type') IS NOT NULL AND GET_DD_PROPERTY_KEY_VALUE(ts.options,'encryption') IS NULL ' failed with error code = 1267, error message = 'Illegal mix of collations (utf8_general_ci,COERCIBLE) and (utf8_unicode_ci,COERCIBLE) for operation '=''.
2019-04-25T06:37:15.988488Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2019-04-25T06:37:15.988789Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-04-25T06:37:17.250580Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.16)  MySQL Community Server - GPL.

将 "utf" 替换为 my.cnf 中的 "utf8mb4" 并重新启动 mysql。

比如我的mysql配置

[client]
default-character-set=utf8mb4

[mysql]
default-character-set=utf8mb4

[mysqld]
collation-server = utf8mb4_unicode_ci
character-set-server = utf8mb4

more reading