Ubuntu – How install or uninstall half-installed thesql-client-5.6 on/from ubuntu 15.10


I probably corrupted my mysql configuration when I tried to install it (again) using the ubuntu package manager (stuck in the middle, because of the required interaction for which there is no screen, (package manager should really give a warning that mysql must be installed via the terminal!)).

Maybe already before, but at least since then, I'm stuck with this error (partly in Dutch):

Fouten gevonden tijdens verwerken van:


E: Sub-process /usr/bin/dpkg returned an error code (1)

I get the error when I try to install, as well as when I try to remove the package or any other mysql component.
I found many solutions on the internet that worked for others, but failed in my case. I already did the following (in advised order, which may be different from the list below):

  • sudo apt-get remove –purge mysql-server mysql-client mysql-common
  • sudo apt-get autoremove
  • sudo service mysql stop
  • sudo killall -9 mysql (no process found)
  • sudo killall -9 mysqld (no process found)
  • sudo deluser mysql
  • sudo rm -rf /var/lib/mysql
  • sudo apt-get purge mysql-server-core-5.5 (fails)
  • sudo rm -rf /var/log/mysql
  • sudo rm -rf /etc/mysql
  • sudo apt-get remove mysql-client-5.6 (fails)
  • sudo apt-get install mysql-client-5.6 (fails)

    I could not find a listing of all the files related to mysql, to manually delete the lot.

    Any suggestion what else I might try (except reinstalling Ubuntu entirely)?

  • Best Answer

    I had the same issue on VM with Ubuntu 14.04. The only thing worked for me is similar to what Richard Uijen has suggested:

    sudo apt-get --purge remove mysql*
    sudo apt-get autoremove mysql*
    sudo rm -rf /etc/mysql/
    sudo rm -rf /var/lib/mysql/
    sudo apt-get clean
    sudo apt-get update
    sudo apt-get install --reinstall mysql-client-5.6

    Basically you need to remove all mysql packages (mysql*), clean and install again

    After that I could install php7 mysql client without any issues

    sudo apt-get install libapache2-mod-php7.0 php7.0-mysql
    Related Question