将值“STRICT_TRANS_TABLES、ERROR_FOR_DIVISION_BY_ZERO、NO_AUTO_CREATE_USER、NO_ENGINE_SUBSTITUTION”设置为“sql_mode”时出错

问题描述 投票:0回答:2

我从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

mysql ubuntu-20.04
2个回答
8
投票

谢谢@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" 


0
投票

在网上查了很多资料,对于8.0版本,我通过修改/etc/mysql/conf.d/strict_mode.cnf设法解决了这个问题 在该文件中,您必须修改模式。

© www.soinside.com 2019 - 2024. All rights reserved.