mysql 安装错误

mysql 安装错误

当我尝试安装 mysql-server 时出现以下错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
mysql-server is already the newest version (5.7.20-0ubuntu0.17.04.1).
0 upgraded, 0 newly installed, 0 to remove and 2 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.20-0ubuntu0.17.04.1) ...
invoke-rc.d: policy-rc.d denied execution of stop.
update-alternatives: error: alternative path /etc/mysql/mysql.cnf doesn't exist
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 2
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
No apport report written because the error message indicates its a followup error from a previous failure.
                            Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

似乎已经安装,但安装过程中失败。尝试通过输入以下命令删除所有以前的安装

apt purge mysql-server

如果有必要

apt purge mysql-server-5.7

然后输入以下命令重试安装

apt install mysql-server

(顺便说一下,这是一个元包,它将安装最新的 MySQL 服务器版本)

相关内容