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



Question:

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.


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.


Solution:4

This saved me from an absolutely horrible situation where other things (http://www.debiantutorials.com/install-mysql-server-5-6-debian-7-8/, for example) got me into trouble with unmet dependencies and so on and so forth.

Thank you!


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »