Report this

What is the reason for this report?

Cannot install MySql in the LAMP stack

Posted on December 19, 2016

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



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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.

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.