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?
4 Answers 4
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
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– Aurora00012017年08月26日 10:09:35 +00:00Commented Aug 26, 2017 at 10:09
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.
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
-
1I fear without first clearing the
held broken packages
this might not better but worse the situation.LotPings– LotPings2017年08月21日 10:25:30 +00:00Commented Aug 21, 2017 at 10:25