我从 ubuntu 18.04 升级到 20.04,现在我的 mysql 不工作了。我记得在从mysql 5.7升级到mysql 8.0的过程中提到了一些注意事项;我记错了。
现在,我无法安装mysql。这就是我得到的:
maan@maan-Inspiron-5537:~$ sudo apt install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
mysql-server is already the newest version (8.0.23-0ubuntu0.20.04.1).
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]
Setting up mysql-server-8.0 (8.0.23-0ubuntu0.20.04.1) ...
Renaming removed key_buffer and myisam-recover options (if present)
ERROR: Unable to start MySQL server:
2021-02-08T08:39:12.431863Z 0 [ERROR] [MY-000077] [Server] /usr/sbin/mysqld: Error while setting value 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_
FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' to 'sql_mode'.
2021-02-08T08:39:12.493831Z 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)
maan@maan-Inspiron-5537:~$
我不想删除现有的数据库。
有出路吗 ?
问题在于
NO_AUTO_CREATE_USER
模式设置,因为它已从 MySQL 8.0 中完全删除。您将需要在配置文件中找到它的定义位置(根据您配置 MySQL 安装的方式,可以是 、 或类似的东西)并将其删除my.cnf
。mysql.cnf
您还可以从文档中明确声明的其他模式中删除:ONLY_FULL_GROUP_BY
、STRICT_TRANS_TABLES
、NO_ZERO_IN_DATE
、NO_ZERO_DATE
、ERROR_FOR_DIVISION_BY_ZERO
和NO_ENGINE_SUBSTITUTION
.有关所有可用模式和默认 MySQL 行为的信息,请参阅第 5.1.11 节,“服务器 SQL 模式”。
删除这些模式标志后,您应该能够启动 MySQL。系统第一次启动时可能会抱怨表的版本错误,然后引擎会立即将 5.7 数据库升级到较新的 8.0 系统。如果您有任何使用 MyISAM 的数据库,您将需要认真考虑在不久的将来更新它们以使用 InnoDB,因为 MySQL 8.0 将发送消息表明旧的 MyISAM 表将在未来被弃用。
希望这可以再次为您提供有效的数据库安装??