运行后sudo apt upgrade
我只是收到错误ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
。
我看到的许多包含此错误的线程都涉及不同的情况和问题。
这是我在'/var/log/mysql/error.log'中的内容:
2020-07-30T09:43:01.219692Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-07-30T09:43:03.681422Z 0 [ERROR] [MY-011292] [Server] Plugin mysqlx reported: 'Preparation of I/O interfaces failed, X Protocol won't be accessible'
2020-07-30T09:43:03.681865Z 0 [ERROR] [MY-011300] [Server] Plugin mysqlx reported: 'Setup of socket: '/var/run/mysqld/mysqlx.sock' failed, can't create lock file /var/run/mysqld/mysqlx.sock.lock'
2020-07-30T09:43:03.710324Z 4 [System] [MY-013381] [Server] Server upgrade from '80020' to '80021' started.
2020-07-30T09:45:34.494717Z 4 [ERROR] [MY-013178] [Server] Execution of server-side SQL statement '-- Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; version 2 of the License.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--
-- View: version
--
-- Shows the sys schema and mysql versions
--
-- NOTE: This view is deprecated and will be removed in a future release.
--
-- mysql> select * from sys.version;
-- +-------------+---------------+
-- | sys_version | mysql_version |
-- +-------------+---------------+
-- | 2.1.1 | 8.0.18 |
-- +-------------+---------------+
--
CREATE OR REPLACE
DEFINER = 'mysql.sys'@'localhost'
SQL SECURITY INVOKER
VIEW version (
sys_version,
mysql_version
) AS
SELECT '2.1.1' AS sys_version,
version() AS mysql_version;
' failed with error code = 1347, error message = ''sys.version' is not VIEW'.
2020-07-30T09:45:34.520029Z 0 [ERROR] [MY-013380] [Server] Failed to upgrade server.
2020-07-30T09:45:34.521143Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-07-30T09:45:36.912218Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.21-0ubuntu0.20.04.3) starting as process 7215
2020-07-30T09:45:37.117399Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
我该如何解决这个问题?我使用 Ubuntu 20.04。
答案1
我遇到了同样的错误。问题是 my.cnf 在 sql_mode 下包含“NO_AUTO_CREATE_USER”。这已在 MySql 8.0 中删除。
我的 中有以下内容/etc/mysql/my.cnf
:
sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
删除 NO_AUTO_CREATE_USER 可解决此问题。