dpkg 修复MySQL,dpkg:错误处理软件包mysql-server

When I try to install mysql-server, an error comes like:

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)

What does it mean. Any ideas?

解决方案

dpkg returning an error code 1 doesn't mean anything specific but it usually has to do with dependency issues. In your case, you tried to install two versions/instances of the same package i.e. mysql-server and mysql-server-5.7. So do the following to remove any redundant dependency issues and install a functioning mysql package

sudo apt-get clean

sudo apt-get purge mysql*

sudo apt-get update

sudo apt-get install -f

sudo apt-get install mysql-server-5.7

sudo apt-get dist-upgrade

this should fix the problem at hand. But in the future, have care about the package names you add after sudo apt-get install since the wrong list of package names - for example redundant entries in the list - results in failure to install either of the packages or worse - you might even find yourself wading through the hellish depths of #DEPENDENCY-HELL