Unable to locate package mysql-server

I installed ubuntu 16.04, after that when i try to install mysql it shows error as

$ sudo apt-get update
[sudo] password for mcerc: 
Reading package lists... Done
mcerc@mcerc-ThinkCentre-M72e:~$ sudo apt-get install mysql
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package mysql
mcerc@mcerc-ThinkCentre-M72e:~$ sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package mysql-server
mcerc@mcerc-ThinkCentre-M72e:~$ ^C
mcerc@mcerc-ThinkCentre-M72e:~$ 

Solution 1:

Whenever u install fresh Ubuntu , you need to update and upgrade the system to install from ubuntu repositories.

sudo apt-get update && sudo apt-get dist-upgrade

Now install anything

 sudo apt-get install mysql-server

Solution 2:

  • First, goto Ubuntu Software and in the menu there will be the option Ubuntu Software. Select it.
  • There, you will Softwares and Updates. Select it. Check if all the official repositories (under the option Ubuntu Software) are checked. If not then check them.
  • Else use the following command for installing mysql-server sudo apt install mysql-server-5.7. This should work.

UPDATE: Ubuntu Software tab is moved to Software & Update, a separate application in Ubuntu 18.04