11

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:~$ 
| improve this question | | | | |
  • I answered your question. If you have any questions, post them as comments in the answer below. – Emad Arshad Alam Oct 5 '16 at 3:57
12

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
| improve this answer | | | | |
  • 3
    You're geneous +1 – Vipertecpro Apr 25 '19 at 4:53
  • @ViperTecPro haha. :) – minigeek May 1 '19 at 16:57
4
  • 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.
| improve this answer | | | | |
  • You can't very well go to Ubuntu Software via the command line... – chrips Nov 20 '18 at 13:49
0

Your problem : mysql-server maybe was installed once and the settings in your machine might be saved somewhere . Remove it completely with .

Uninstall mysql-server first:

sudo apt-get remove --purge mysql-server 

install it again. Run this command:

sudo apt-get install mysql-server

This also help to fix broken packages, so if these commands above failed tried to fix packages first and then remove and install the mysql-server:

sudo apt-get -f install
| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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