首页 > 解决方案 > 将值“STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”设置为“sql_mode”时出错

问题描述

我从 Ubuntu 18 升级到 Ubuntu 20。升级过程中 mySQL 升级失败。升级后,我再次尝试安装mysql-server。我收到以下错误。

ERROR: Unable to start MySQL server:
2021-05-29T02:51:22.812281Z 0 [Warning] [MY-011068] [Server] The syntax 'expire-logs-days' is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead.
2021-05-29T02:51:22.812291Z 0 [ERROR] [MY-000077] [Server] /usr/sbin/mysqld: Error while setting value 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' to 'sql_mode'.
2021-05-29T02:51:22.813552Z 0 [ERROR] [MY-010119] [Server] Aborting

使用的命令:sudo apt install mysql-server

我在升级到 Ubuntu20 后使用了上述命令。我什至尝试编辑配置,但这没有帮助。以下是/etc/mysql/mysql.cnf的内容:

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
[mysqld]
sql_mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"

我在这里发现了一个类似的问题:https ://askubuntu.com/questions/1296168/mysql-fail-after-ubuntu-20-04-upgrade

标签: mysqlubuntu-20.04

解决方案


谢谢@FANO_FN。这是/etc/mysql/mysql.conf.d/mysqld.cnf需要纠正的地方。mysql8 不再具有 NO_AUTO_CREATE_USER sql_mode的值。所以,我从值列表中删除了它并开始工作。

最终值如下所示:

sql_mode = STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"


推荐阅读