5

I tried installing mysql using the command

sudo apt-get install mysql-server

then after entering the password, I'm getting the message

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package mysql-server

Why is this happening, and how can I solve it?

Pandya
  • 35,771
  • 44
  • 128
  • 188

3 Answers3

8

Apart from depeneding on the Repository source. You can try following

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

Then search for the package using apt-cache.

sudo apt-cache search mysql | grep mysql | more

You will have couple of results and you can choose appropriate one for you. You might need the client or Server (depends on your needs). The result is as below:

    mysql-server - MySQL database server (metapackage depending on the latest version)
    mysql-server-5.5 - MySQL database server binaries and system database setup
    mysql-client - MySQL database client (metapackage depending on the latest version)
mysql-server - MySQL database server (metapackage depending on the latest version)
 mysql-client-5.5 - MySQL database client binaries

Once you figure out what version of sql is available. You can install it with apt-get.

sudo apt-get install mysql-server mysql-client

Hope this helps. Alos this is the official Mysql Community page to download MySQL Server for different platforms.

0

The package name it will install is mysql-server-5.6 (the digits are there so you could also install another version; like 5.5). So you can also use ...

sudo apt-get install mysql-server-5.6 

I would suggest to update your system if not updated and to check the repositories you have active.

$ sudo apt-get install mysql-server
[sudo] password: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-3.19.0-15 linux-headers-3.19.0-15-generic
  linux-image-3.19.0-15-generic linux-image-3.19.0-7-generic
  linux-image-extra-3.19.0-15-generic linux-image-extra-3.19.0-7-generic

mysql-server should be present on any Ubuntu system by default.

Rinzwind
  • 299,756
0

Is your sources.list file correct?

By the way; you can install deb package from http://packages.ubuntu.com/ and install it using dpkg -i PACKAGENAME. For ubunut 14.04 you can download it from here.