dpkg: error processing package mysql-server

后端 未结 13 990
悲&欢浪女
悲&欢浪女 2020-12-31 04:44

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

dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigure         


        
13条回答
  •  一生所求
    2020-12-31 05:18

    All of the answers I've been able to find for this question have been of the form "purge your Mysql install and re-install it." But in my case, I already have a working/active Mysql install. For me, the reason why dpkg --configure -a fails is because Mysql is already installed. Why dpkg thinks that the postinstall script needs to be run for my already-installed-and-upgraded Mysql I may never know, but it does.

    After considerable time scouring for answers, I found a solution that should work if there are others who already have a working Mysql 5.7 and just want to get past this bogus postinstall script. You can edit the postinstall script directly as (on Ubuntu):

    sudo vi /var/lib/dpkg/info/mysql-server-5.7.postinst

    And then, on the second line, just add exit 0 and then run dpkg again and you should get something like:

    $ sudo dpkg --configure -a         
    Setting up mysql-server-5.7 (5.7.28-0ubuntu0.18.04.4) ...
    

    You definitely would not want to follow these instructions if your Mysql installation had not previously completed (there's a reason that the postinstall script insists on running). But for those who might end up with dpkg in a wonky state, as I have, the above can save you a lot of time purging and reinstalling an already-working version of Mysql.

提交回复
热议问题