Cannot install MySql in the LAMP stack

December 19, 2016 2.3k views
LAMP Stack Ubuntu 16.04

Error Message:
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: Package 'php5-mysql' has no installation candidate

2 Answers

PHP5 is no longer included as of Ubuntu 16.04 as it has been replaced with PHP 7. Instead of the package php5-mysql you will want to install the package php-mysql. For other PHP related stuff you will use php7.0 as in php7.0-gzip in place of php5-gzip

This worked for me. I installed apache first with sudo apt-get install apache2 and added ufw allow port 80 and 8080.

Then I tried to install mysql and php, but 5 wasn't valid, so instead it is sudo apt-get install mysql-server php-mysql instead of php5-mysql

Next I did sudo apt-get install php7.0 php7.0-mcrypt

Then I authorized mysql and php in ufw. ALL worked fine.

Have another answer? Share your knowledge.