在 ubuntu 16.04 中安装 mysql-server 时出错

在 ubuntu 16.04 中安装 mysql-server 时出错
update-rc.d: error: insserv rejected the script header
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
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)

安装时出现此错误。我使用以下命令进行安装:

sudo apt install mysql-server

我还尝试过清除/删除整个软件包、启动和停止服务、自动清理、自动删除。一切。请帮助我安装 mysql-server 和客户端。

答案1

尝试使用以下命令将其删除:

sudo apt-get --auto-remove purge mysql\*
sudo apt-get -f install
sudo apt-get --auto-remove purge mysql\*
sudo rm -rf /etc/mysql* /var/lib/mysql* /usr/share/mysql* /var/log/mysql
sudo apt-get clean

看看是否清理干净

sudo updatedb
locate mysql

并扫描输出中卸载后遗留的文件夹、包或文件。

确保这些也都消失后,重新干净地安装它:

sudo apt-get update
sudo apt-get install mysql-server mysql-server-5.7 mysql-client-5.7 mysql-client

相关内容