Ubuntu – Cannot install thesql-server-5.5/the following packages have unmet dependicies

aptdependenciesMySQLpackage-managementsoftware installation

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.

Best Answer

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.

Related Question