升级到 Ubuntu 19.10 无法安装 mysql-server-8.0

升级到 Ubuntu 19.10 无法安装 mysql-server-8.0

从 19.04 升级完成并出现错误,然后当我运行sudo apt-get upgradesudo apt-get install mysql-server出现以下情况时:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up mysql-server-8.0 (8.0.17-0ubuntu2) ...
Renaming removed key_buffer and myisam-recover options (if present)
ERROR: Unable to start MySQL server:
2019-10-23T04:23:50.510438Z 0 [ERROR] [MY-000077] [Server] /usr/sbin/mysqld: Error while setting value 'IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' to 'sql_mode'.
2019-10-23T04:23:50.512017Z 0 [ERROR] [MY-010119] [Server] Aborting
Please take a look at https://wiki.debian.org/Teams/MySQL/FAQ for tips on fixing common upgrade issues.
Once the problem is resolved, run apt-get --fix-broken install to retry.
dpkg: error processing package mysql-server-8.0 (--configure):
 installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-8.0; however:
  Package mysql-server-8.0 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Errors were encountered while processing:
 mysql-server-8.0
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

我暂时启用了“预发布更新(eoan-proposed)”并再次运行,sudo apt-get update结果sudo apt-get upgrade相同。

我一直在寻找但找不到合适的解决方案。

关于如何解决这个问题有什么想法吗?只要当前数据库完好无损,我不介意回滚到以前的 mysql-server 版本。

短暂性脑缺血发作

答案1

MySQL 服务器无法启动以完成其安装:

Error while setting value 'IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' to 'sql_mode'

这些 SQL 模式中的一个或多个在新版 MySQL 中不再可用。就你的情况而言,是NO_AUTO_CREATE_USER

在此处查看有效模式的列表:https://dev.mysql.com/doc/refman/8.0/en/server-options.html#option_mysqld_sql-mode

编辑您的/etc/mysql/my.cnf并从选项列表中删除无效模式sql-mode=...

答案2

遇到了同样的问题。以下是我修复它的方法。首先从

var/lib/mysql

然后清除并重新安装 MySQL

sudo apt purge mysql* mariadb*
sudo apt install mysql-server

相关内容