mysql - 将值“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
解决方案
谢谢@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"
推荐阅读
- ionic-framework - Ionic 3 应用内浏览器执行脚本错误
- python - infinity b'' 通过烧瓶运行 shell 脚本的问题
- postgresql - 致命:用户“postgres”的密码验证失败(postgresql 12 和 pgAdmin 4)
- reactjs - Gatsby 和 Theme-UI ColorModeProvider
- c# - 嵌套 SemaphoreSlims、安全和死锁
- git - 提交前检查 git commit 评论(检查评论中的分支名称)
- flutter - 如何阻止音频在颤动中播放
- python - 如何根据某些条件迭代python中的列表项?
- php - 将特征函数引用存储在数组中
- javascript - 使用javascript ajax接收数据并在html中显示