How to reinstall broken mysql package

Take a super user privileges first by following commands. sudo -i will give you the root access.

The following worked for me :

apt-get -f install -o Dpkg::Options::="--force-overwrite"

And followed by:

apt-get purge mysql\*
rm -rf /var/lib/mysql
rm -rf /etc/mysql
dpkg -l | grep -i mysql
apt-get clean
updatedb
apt-get install mysql-client-core-5.5  mysql-client-5.5 mysql-common mysql-server-5.5

For MySql5.6 use the below

apt-get install mysql-client-core-5.6 mysql-client-5.6 mysql-server-5.6

Make sure to backup all data as this will delete everything.

I found this solution here


I have got this working:

apt-get remove --purge mysql-client-5.5 mysql-common mysql-server mysql-server-5.5 mysql-server-core-5.5
apt-get -f install -o Dpkg::Options::="--force-overwrite" mysql-server

This recreated me deleted /ets/mysql and /var/lib/mysql directories with defaults. I have found this packages list with OP's dpkg -l | grep -i mysql .