Cannot install MySql in the LAMP stack

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

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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