Ubuntu 20.04 升级后 MySQL 失败

Ubuntu 20.04 升级后 MySQL 失败

我使用了 Ubuntu 18.04 和 LAMP、Python、Dockers 等。有一次,我收到一条消息,说我的笔记本电脑已准备好升级,我接受了,更新过程开始了。在过程进行到 50% 时,我收到一条消息,说出现了问题,Ubuntu 停止升级。在重启过程中,我看到了以下消息:

[FAILED] Failed to start MySQL Community Server.

因此我尝试了解我的 MySQL 的状态:systemctl status mysql.service并得到了结果:

     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sun 2020-11-29 10:46:34 EET; 6h ago

лис 29 10:46:34 it-HP-250-G7-Notebook-PC mysql-systemd-start[1635]: Please take a look at https://wiki.debian.org/Teams/MySQL/FAQ for tips o>
лис 29 10:46:34 it-HP-250-G7-Notebook-PC mysql-systemd-start[1635]: Once the problem is resolved, restart the service.
лис 29 10:46:34 it-HP-250-G7-Notebook-PC systemd[1]: mysql.service: Control process exited, code=exited, status=1/FAILURE
лис 29 10:46:34 it-HP-250-G7-Notebook-PC systemd[1]: mysql.service: Failed with result 'exit-code'.
лис 29 10:46:34 it-HP-250-G7-Notebook-PC systemd[1]: Failed to start MySQL Community Server.
лис 29 10:46:34 it-HP-250-G7-Notebook-PC systemd[1]: mysql.service: Scheduled restart job, restart counter is at 6.
лис 29 10:46:34 it-HP-250-G7-Notebook-PC systemd[1]: Stopped MySQL Community Server.
лис 29 10:46:34 it-HP-250-G7-Notebook-PC systemd[1]: mysql.service: Start request repeated too quickly.
лис 29 10:46:34 it-HP-250-G7-Notebook-PC systemd[1]: mysql.service: Failed with result 'exit-code'.
лис 29 10:46:34 it-HP-250-G7-Notebook-PC systemd[1]: Failed to start MySQL Community Server.

接下来我尝试修复所有软件包:sudo apt-get updatesudo apt-get upgrade但在最后的命令行中看到下一个警告:

2020-11-29T15:12:34.680279Z 0 [ERROR] [MY-000077] [Server] /usr/sbin/mysqld: Error while setting value 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,N
O_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' to 'sql_mode'.
2020-11-29T15:12:34.696826Z 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

接下来我尝试修复所有安装:sudo apt-get --fix-broken install,但对我没什么帮助。我不想删除 MySQL,因为我有实际的数据库,它对我很重要。

有什么建议么?

答案1

请在此处查看答案:https://stackoverflow.com/a/67747756/6652972

谢谢@FANO_FN。这是 /etc/mysql/mysql.conf.d/mysqld.cnf需要更正的行。mysql8 没有 NO_AUTO_CREATE_USER 的值sql_模式 不再。因此,我将其从值列表中删除,然后它开始工作。

最终值如下所示:

sql_mode = STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"

原因是它NO_AUTO_CREATE_USER不再是 mysql8 的一部分。

相关内容