Having issues installing MySQL

January 3, 2017 2.5k views
LAMP Stack MySQL Ubuntu 16.04

I'm using the code sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

And I am getting back this

```root@user:~# sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php5-mysql is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Unable to locate package libapache2-mod-auth-mysql
E: Package 'php5-mysql' has no installation candidate```

I'm not sure what to do, I don't have much knowledge about literally anything I'm doing, I'm trying to learn how to set up an image hosting website but I have absolutely no knowledge about any of this, thanks.

4 Answers
jtittle1 January 6, 2017
Accepted Answer

@sethwaters1999

Since you're on Ubuntu 16.x, you would need to use PHP 7 packages, which can be found by using:

sudo apt-cache search php7 --names-only

The package name for PHP's MySQL extension is php7.0-mysql. If you still want PHP 5.x packages you would need to install a repository which offers them or use an older LTS release of Ubuntu (though keep in mind, 16.04 is the latest LTS, thus support for older releases is coming to an end).

The repository in question can be added by running:

sudo add-apt-repository ppa:ondrej/php -y \
&& apt-get update

... then running:

sudo apt-cache search php5 --names-only

You could then install PHP 5.6.x packages.

What version of the OS are you using? Sounds like you are using a updated version like Ubuntu 16 where PHP is now version 7 and not version 5.

If you are wanting to install a web server and or even just Mysql a great system to help you with this is VestaCP a free web panel thats installed in only a few commands, it will install apache, nginx, mysql, a mail server and more for you.

What about the second error:

E: Unable to locate package libapache2-mod-auth-mysql

How did you fix that.Thanks for sharing!

Have another answer? Share your knowledge.