dpkg: error processing package mysql-server

2020-07-03 03:39发布

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?

10条回答
姐就是有狂的资本
2楼-- · 2020-07-03 04:05

My answer from askubuntu.

None of the apt methods worked for me, try this:

Find locking process

$ ps -eaf
root      7316     1  0 00:19 ?        00:00:00 /usr/bin/dpkg --status-fd 35 --configure --pending
root      7808  7316  0 00:19 ?        00:00:00 /usr/bin/perl -w /usr/share/debconf/frontend /var/lib/dpkg/info/mysql-se
root      7817  7808  0 00:19 ?        00:00:00 /bin/bash /var/lib/dpkg/info/mysql-server-5.7.postinst configure
mysql     7973  7817  0 00:20 ?        00:00:00 mysqld --user=mysql --init-file=/var/lib/mysql-files/tmp.iNyY06ty0K --so

Kill it

do sudo kill -9 7973, basically the mysql one.

Now purge

sudo apt-get purge mysql-server-5.7 # Or whatever you are trying to purge.
查看更多
Explosion°爆炸
3楼-- · 2020-07-03 04:06

If you are working on Debian 10, you need to first install GNUPG:

sudo apt-get install gnupg

That's all; now you can try dpkg again.

查看更多
不美不萌又怎样
4楼-- · 2020-07-03 04:09

To solve the dependency issue, try:

sudo apt-get purge
sudo apt-get clean
sudo apt-get check

And reinstall the package again by: sudo apt-get install mysql-server.

Source: Thread: Dpkg: Dependency problems - leaving unconfigured.

Other commands to try:

sudo apt-get install -f
sudo apt-get autoremove
sudo dpkg --configure -a 

Related: How can I Resolve dpkg dependency? at Ask Ubuntu.

查看更多
唯我独甜
5楼-- · 2020-07-03 04:16

I was in the same situation. After completely removing MySQL, I reinstalled it, killed the PID using port 3306, and reinstalled MySQL again. It's working now.

screenshot

查看更多
劳资没心,怎么记你
6楼-- · 2020-07-03 04:18

I had a similar issue. This is how I fixed mine.

  1. Restart MySQL service sudo service mysql restart
  2. Then fix broken installations sudo apt install -f
查看更多
▲ chillily
7楼-- · 2020-07-03 04:19

If you're on a VPS or similar, your error may be due to lack of RAM.

Running apt-upgrade seems to require some RAM, so it may force-close mysql, hence the problem to recover from the error.

Try:

1) Stop mysql manually before any apt-upgrade

sudo /etc/init.d/mysql stop

2) Fix:

sudo dpkg --configure mysql-server-X.X

(if version not known, use just mysql-server to find out (will not fix error)

3) Check:

sudo apt-get upgrade

Start mysql manually if it wasn't started by apt.

查看更多
登录 后发表回答