升級到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-提議)”並再次運行,sudo apt-get update結果sudo apt-get upgrade相同。

我一直在尋找,但找不到合適的解決方案。

關於如何解決這個問題有什麼想法嗎?只要目前資料庫完好無損,我不介意回滾到以前的 mysql-server 版本。

TIA

答案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'

在新的 MySQL 版本中,這些 sql 模式中的一種或多種不再可用。就你而言,是的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

相關內容