2

When I install mysql-server, I get the following error:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
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.7 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

However, I am able to install the mysql-client without any problem. I have tried all the solutions given for related questions but nothing worked. The related problems I have tried are:

The following question also does not match with my problem: Error in installing Mysql-server in ubuntu16.04

Could anyone help me to resolve this issue. Thanks in advance.

  • Check what other mysql packages you have in the system - apt list --installed | grep mysql. In my case there was a conflict with mysql-common and I had to remove it (it also removed some of the packages I need, so I reinstalled them later). After that I was able to install mysql normally. – Cheery Aug 7 '16 at 21:37
  • Thanks Cherry, but there are no other mysql packages. The apt list --installed | grep mysql returns nothing. – Gobinath Aug 7 '16 at 23:53
1

Finally, I found a solution from this site.

As stated in other answers, uninstall all the existing mysql modules. To get the list of installed mysql modules, use the following command:

dpkg -l | grep mysql

Download the mysql-apt-config_0.7.3-1_all.deb from the MySQL website.

Install the package using the following command:

sudo dpkg -i mysql-apt-config_0.7.3-1_all.deb

Create a new file /etc/apt/preferences.d/mysql with this content

Package: *
Pin: origin "repo.mysql.com"
Pin-Priority: 999

Run the following command to update the cache

sudo apt update

Run the following command to install MySQL

sudo apt install mysql-client mysql-server libmysqlclient-dev

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.