我正在尝试更新系统,但是mysql 5.7失败了。由于身份验证问题,它似乎无法连接。
以下是完整的控制台输出:
Reading package lists... Done
Building dependency tree
Reading state information... Done
mysql-server-5.7 is already the newest version (5.7.23-0ubuntu0.16.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] y
Setting up mysql-server-5.7 (5.7.23-0ubuntu0.16.04.1) ...
Renaming removed key_buffer and myisam-recover options (if present)
mysql_upgrade: Got error: 1045: Access denied for user 'root'@'localhost' (using password: NO) while connecting to the MySQL server
Upgrade process encountered error and will not continue.
mysql_upgrade failed with exit status 11
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)重要的bit:
mysql_upgrade: Got error: 1045: Access denied for user 'root'@'localhost'我可以使用"mysql -u root -p“命令登录。我不使用密码登录到服务器,因为我使用ssh键,如果这是重要的。
为什么现在会出现这个问题,如何解决这个问题呢?我也有很长一段时间没有更新系统了,但这是唯一有问题的包。
发布于 2018-10-05 09:08:36
您可以尝试通过Unix启用mySQL的无密码登录,这通常是默认启用的,但可能已经更改了。
登录到mysql根shell并运行以下命令:
grant usage on *.* to 'root'@'localhost' identified via unix_socket;如果这不起作用,请尝试添加一个包含内容的文件~/.my.cnf:
[client]
user=root
password=your_password使其仅由所有者(和root用户)读取:
chmod 600 ~/.my.cnf然后再试一次
https://askubuntu.com/questions/1081108
复制相似问题