Error in installing mysql-server in Ubuntu 16.04

19,640

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
Share:
19,640

Related videos on Youtube

Gobinath
Author by

Gobinath

Computer Science Engineering undergraduate and Java lecturer in an IT institute.

Updated on September 18, 2022

Comments

  • Gobinath
    Gobinath over 1 year

    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.

    • Cheery
      Cheery almost 8 years
      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.
    • Gobinath
      Gobinath almost 8 years
      Thanks Cherry, but there are no other mysql packages. The apt list --installed | grep mysql returns nothing.