Ubuntu 16.04:执行安装时出错(sudo apt install mysql-server)

Ubuntu 16.04:执行安装时出错(sudo apt install mysql-server)

我在 ubnutu 升级后遇到了 mysql 问题,所以我只是按照脚步比如先清除然后安装新的 sudo apt purge mysql-server mysql-server-5.7 mysql-server-core-5.7

但我在执行安装时遇到了这些错误。

update-alternatives: error: alternative link /etc/mysql/my.cnf is already managed by my.cnf.bak
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.
                                                                                                          Processing triggers for systemd (229-4ubuntu17) ...
Processing triggers for ureadahead (0.100.0-19) ...
Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

尝试运行它并看看结果如何。

sudo service mysql stop
sudo apt remove mysql*
sudo apt purge mysql*
sudo apt autoremove
sudo apt install mysql-server

要运行包含的安全脚本:

sudo mysql_secure_installation

如果您收到任何错误,请使用此输出更新您的问题。

相关内容