mysql-server cant install on linux

16,188

Solution 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

Solution 2

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^
Share:
16,188
Bozgun
Author by

Bozgun

Updated on June 30, 2022

Comments

  • Bozgun
    Bozgun almost 2 years

    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?

  • Nilesh Bavliya
    Nilesh Bavliya over 2 years
    Thanks for the useful answer you save my lots of time.