3

I am trying to install mysql on my pi. I've installed mysql server successfully, but get the following error when I try to run

$ sudo apt-get install php5-mysql

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php5-mysql : Depends: libmysqlclient18 but it is not installable
E: Unable to correct problems, you have held broken packages.

Any ideas what I can do to fix this?

2

I solved this problem replace php5-mysql by the php version installed. The php version is show with:

$sudo php --version

PHP 7.0.19-1 (cli) (built: May 11 2017 14:04:47) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
 with Zend OPcache v7.0.19-1, Copyright (c) 1999-2017, by Zend Technologies

then:

$ sudo apt-get install php7.0-mysql

$sudo systemctl restart apache2
1

I managed to install with:

sudo apt-get install php-mysql

It appears that PHP 7 packages are then installed instead of the 5 version.

  • Have you switched to Raspbian Stretch, by any chance? I believe PHP 7 is in that repo, but not Jessie. – Aurora0001 Aug 26 '17 at 10:09
1

Using the command

apt-cache search mysql | grep mysql

you'll find exactly which the versions of php and php-mysql might be used. In my case (Raspbian 8.0 Jessie) I have php5 and php5-mysql.

0

Maybe try apt-get update && apt-get dist-upgrade and then try installing php5-mysql or php-mysql or you can try answer from this similar question

Failed MySQL install (Raspbian)

  • 1
    I fear without first clearing the held broken packages this might not better but worse the situation. – LotPings Aug 21 '17 at 10:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.