在 Ubuntu 16.04 和 MySQL APT Repo 上使用 sudo apt upgrade 从 8.0.13 升级到 8.0.15 后,mysql-server 崩溃

在 Ubuntu 16.04 和 MySQL APT Repo 上使用 sudo apt upgrade 从 8.0.13 升级到 8.0.15 后,mysql-server 崩溃

运行后$ sudo apt upgrade我得到以下输出:

Setting up mysql-apt-config (0.8.12-1) ...
OK
Setting up mysql-common (8.0.15-1ubuntu16.04) ...
Setting up mysql-community-client-core (8.0.15-1ubuntu16.04) ...
Setting up mysql-community-client (8.0.15-1ubuntu16.04) ...
Setting up mysql-client (8.0.15-1ubuntu16.04) ...
Setting up mysql-community-server-core (8.0.15-1ubuntu16.04) ...
Setting up mysql-community-server (8.0.15-1ubuntu16.04) ...
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2019-02-05 12:12:36 EST; 14ms ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 1702 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
  Process: 1660 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 1702 (code=exited, status=1/FAILURE)
   Status: "SERVER_BOOTING"
    Error: 2 (No such file or directory)

Feb 05 12:12:32 rp-rhumanos systemd[1]: Starting MySQL Community Server...
Feb 05 12:12:36 rp-rhumanos systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Feb 05 12:12:36 rp-rhumanos systemd[1]: Failed to start MySQL Community Server.
Feb 05 12:12:36 rp-rhumanos systemd[1]: mysql.service: Unit entered failed state.
Feb 05 12:12:36 rp-rhumanos systemd[1]: mysql.service: Failed with result 'exit-code'.
dpkg: error processing package mysql-community-server (--configure):
 subprocess installed post-installation script returned error exit status 1
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-community-server (= 8.0.15-1ubuntu16.04); however:
  Package mysql-community-server is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Setting up open-iscsi (2.0.873+git0.3b4b4500-14ubuntu3.7) ...
Setting up update-notifier-common (3.168.10) ...
Setting up ca-certificates (20170717~16.04.2) ...
Setting up nodejs (8.15.0-1nodesource1) ...
Setting up python3-software-properties (0.96.20.8) ...
Setting up software-properties-common (0.96.20.8) ...
Processing triggers for initramfs-tools (0.122ubuntu8.14) ...
update-initramfs: Generating /boot/initrd.img-4.4.0-142-generic
W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.
Processing triggers for ca-certificates (20170717~16.04.2) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
Errors were encountered while processing:
 mysql-community-server
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

/var/log/mysql/error.log

2019-02-05T17:11:35.479041Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.13)  MySQL Community Server - GPL.

2019-02-05T17:12:32.897881Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.15) starting as process 1702
2019-02-05T17:12:32.900620Z 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-02-05T17:12:32.900673Z 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-02-05T17:12:34.391241Z 1 [ERROR] [MY-013178] [Server] Execution of server-side SQL statement 'INSERT INTO routines SELECT * FROM mysql.routines' failed with error code = 1265, error message = 'Data truncated for column 'sql_mode' at row 49'.
2019-02-05T17:12:34.420633Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2019-02-05T17:12:34.421175Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-02-05T17:12:35.940432Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.15)  MySQL Community Server - GPL.

2019-02-05T17:14:53.008361Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.15) starting as process 12667
2019-02-05T17:14:53.010824Z 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-02-05T17:14:53.010868Z 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-02-05T17:14:54.532359Z 1 [ERROR] [MY-013178] [Server] Execution of server-side SQL statement 'INSERT INTO routines SELECT * FROM mysql.routines' failed with error code = 1265, error message = 'Data truncated for column 'sql_mode' at row 49'.
2019-02-05T17:14:54.558588Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2019-02-05T17:14:54.559042Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-02-05T17:14:55.905747Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.15)  MySQL Community Server - GPL.

2019-02-05T17:20:01.163354Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.15) starting as process 13204
2019-02-05T17:20:01.165941Z 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-02-05T17:20:01.166007Z 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-02-05T17:20:02.652928Z 1 [ERROR] [MY-013178] [Server] Execution of server-side SQL statement 'INSERT INTO routines SELECT * FROM mysql.routines' failed with error code = 1265, error message = 'Data truncated for column 'sql_mode' at row 49'.
2019-02-05T17:20:02.690212Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2019-02-05T17:20:02.691358Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-02-05T17:20:04.043861Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.15)  MySQL Community Server - GPL.

请帮忙,我花了 10 多个小时在 Google 上寻找解决方案 :(

答案1

检查你的 my.cnf。我刚刚升级了自己,经过几分钟的故障排除后,我发现我添加到 my.cnf 中的自定义值是罪魁祸首,所以我将所有内容都注释掉了:

#query_cache_size = 0
#query_cache_type = 0
#query_cache_limit = 2M
#sort_buffer_size = 512K
#read_rnd_buffer_size = 512K
#tmp_table_size = 32M
#max_heap_table_size = 32M
#thread_pool_size = 24M
#innodb_log_file_size = 16M

由于我没有时间一一进行分析,所以我不能确定是哪一个问题,但其中一个肯定是有问题的。

相关内容