Cannot install mysql-server-5.5/the following packages have unmet dependicies

108,402

Solution 1

Open the terminal and type:

sudo apt-get purge mysql-client-core-5.6
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt install mysql-client-core-5.5
sudo apt install mysql-server  

Both MySQL database core client and MySQL Server packages will be the same version 5.5. MySQL Client 5.5 and MySQL Server 5.5 are the current "best" versions of these packages in Ubuntu 14.04 as determined by the package maintainers. If you would rather install MySQL Client 5.6 and MySQL Server 5.6 you can also find the mysql-client-core-5.6 and mysql-server-5.6 packages in the Ubuntu Software Center. The important thing is that the client and server version numbers match in either case.

In Ubuntu 16.04 and 18.04 the names of these two packages are mysql-client-core-5.7 and mysql-server-5.7.

Solution 2

Following command has solved my problem.

sudo aptitude install mysql-server

If aptitude is not installed in your computer, first install aptitude using following command.

sudo apt-get install aptitude

Solution 3

I solved this problem using Synaptic Package Manager.

I figured out that, in my case, I'm using different versions of MySQL common, server and client sides.

In particular, for common I was using a mariabd repository to get the file. I've change this using Package > Force version in Synaptic and choosing the same version (5.7.12) for all packages.

Hope this help.

Share:
108,402

Related videos on Youtube

Amuna
Author by

Amuna

Updated on September 18, 2022

Comments

  • Amuna
    Amuna over 1 year

    I'm a newbie here so please bear with me.

    I'm using ubuntu 14.04.

    I tried entering mysql with the following command:

    mysql -u root -p
    

    and I got the following message:

    The program mysql can be found on the following packages:
    * mysql-client-core-5.5 
    * mariadb-client-core-5.5 
    * mysql-client-core-5.6 
    * percona-xtrabd-cluster-client-5.5 
    

    I then typed in:

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

    After this was installed, I tried connecting to mysql again using:

    mysql -u root -p
    

    I then got the error message:

    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    

    After searching online, I found out I needed to install mysql server and so I wrote in the following command

    sudo apt-get install mysql-server
    

    I then got the message:

    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    
    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.
    

    I've been looking on line for the past hour for a solution but other people who had a similar error but had it from upgrading mysql and thus there solution were ineffective for me.

    • aroll605
      aroll605 almost 10 years
      Try sudo apt-get install --fix-missing --force
    • Ai Kudou
      Ai Kudou about 5 years
      I tried this and it works. I'm not quite sure if it can help you.
  • Jonas Gröger
    Jonas Gröger about 9 years
    Imho, this will not solve the problem. See explanation of @karel.
  • acsadam0404
    acsadam0404 about 8 years
    It solved the problem for me and @karel's didn't.
  • Toolkit
    Toolkit over 6 years
    nope, same stuff 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.
  • karel
    karel over 6 years
    @Toolkit Fix that error like this: E: Unable to correct problems, you have held broken packages In Ubuntu 16.04 it's mysql-client-core-5.7 and mysql-server-5.7.
  • Rahul
    Rahul almost 4 years
    Thanks A Ton! Mate, you are a Savior! BrAvo!!!!!
  • Mauricio Toledo
    Mauricio Toledo over 3 years
    I got error E: Package 'mysql-client-core-5.5' has no installation candidate
  • karel
    karel over 3 years
    In Ubuntu 16.04 and 18.04 the name of this package is mysql-client-core-5.7 as mentioned in the last sentence of this answer.