5

I removed the current mysql like that :

apt-get remove --purge mysql-server mysql-client mysql-common
apt-get remove --purge mysql-client-core-5.5
apt-get autoremove
apt-get autoclean
rm -rf /var/lib/mysql

And than when I want to reinstall I got some problems:

apt-get install mysql-server 

//the output is

The following packages have unmet dependencies:
 mysql-server : Depends: mysql-server-5.5 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.**

and again

apt-get install mysql-server-5.5 

//the output is

The following information may help to resolve the situation:

The following packages have unmet dependencies:
mysql-server-5.5 : PreDepends: mysql-common (>= 5.5.47-0+deb7u1) but it is not going to be installed
Depends: mysql-client-5.5 (>= 5.5.47-0+deb7u1) but it is not going to be installed
Recommends: mailx
E: Unable to correct problems, you have held broken packages.

I have already installed many times mysql-common and mysql-clint-5.5

What might be problem?

Ipor Sircer
  • 3,069
  • 3
  • 10
  • 15
Bozgun
  • 89
  • 1
  • 1
  • 6
  • In my case I had to run `sudo apt remove mysql-common` before the installation command started working. – Finesse Jun 09 '23 at 07:10

2 Answers2

5

I wrote this script to resolve such problem in my ubuntu 20.04, see details in my comments:

#!/bin/bash

#Force install of missing deps
sudo apt-get -f install -o Dpkg::Options::="--force-overwrite"

#Remove the installed Apache 2
sudo apt-get purge apache2\*

#And followed by:
sudo apt-get purge mysql\*
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
sudo dpkg -l | grep -i mysql
sudo apt-get clean
sudo apt-get aut
sudo updatedb

#Reinstall full webstack if you want to.
sudo apt-get install lamp-server^
sɐunıɔןɐqɐp
  • 3,332
  • 15
  • 36
  • 40
Kwence Smart
  • 51
  • 1
  • 2
1

I solved this after 6 hours :) Main problem was version number.After unistalling you should write like this:

To install mysql-server :

firstly install mysql-server-5.5

And to install mysql-server-5.5:

install mysql-common apt-get install mysql-common=5.5.47-0+deb7u1

install mysql-client-5.5 apt-get install mysql-client=5.5.47-0+deb7u1

After install them : install mysql-server-5.5 apt-get install mysql-server-5.5

And finally : install mysql-server mysql-client apt-get install mysql-server mysql-client

Bozgun
  • 89
  • 1
  • 1
  • 6