以下软件包具有未满足的依赖关系:mysql-server

以下软件包具有未满足的依赖关系:mysql-server

我尝试在 ubuntu16.04 上为 django 项目安装 mysql。安装过程中某些现有文件出现问题,出现以下错误:

mysql-server is already the newest version (5.7.19-0ubuntu0.16.04.1).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 mysql-server : Depends: mysql-server-5.7 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution)

我尝试过sudo apt-get -f install,但出现此错误:

Preparing to unpack .../mysql-server-5.7_5.7.19-0ubuntu0.16.04.1_amd64.deb ...
grep: /etc/mysql/: No such file or directory
Aborting downgrade from (at least) 10.2 to 5.7.
If are sure you want to downgrade to 5.7, remove the file
/var/lib/mysql/debian-*.flag and try installing again.
dpkg: error processing archive /var/cache/apt/archives/mysql-server-5.7_5.7.19-0ubuntu0.16.04.1_amd64.deb (--unpack):
 subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/mysql-server-5.7_5.7.19-0ubuntu0.16.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

因此我尝试卸载该软件包并清除并清理但出现第一个错误,希望有人可以帮助我。

答案1

注意:运行时sudo apt-get autoremove,请在接受更改之前检查要卸载的软件包,以确保不会卸载您想要保留的内容。

如果您没有手动安装任何专有驱动程序(如 nvidia),请运行以下命令:

sudo touch /etc/mysql
sudo apt-get clean
sudo apt-get autoremove
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get -f install

如果您确实手动安装了任何专有驱动程序(如 nvidia),请运行以下命令:

sudo touch /etc/mysql
sudo apt-get clean
sudo apt-get autoremove
sudo apt-get update
sudo apt-get upgrade
sudo apt-get -f install

请发布任何错误,谢谢!

相关内容