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?

Bex
2,9293 gold badges27 silver badges34 bronze badges
asked Aug 21, 2017 at 10:19
0

4 Answers 4

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
answered Aug 29, 2017 at 20:04
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.

Aurora0001
6,3773 gold badges25 silver badges39 bronze badges
answered Aug 26, 2017 at 9:37
1
  • Have you switched to Raspbian Stretch, by any chance? I believe PHP 7 is in that repo, but not Jessie. Commented Aug 26, 2017 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.

answered May 12, 2018 at 17:14
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)

Bex
2,9293 gold badges27 silver badges34 bronze badges
answered Aug 21, 2017 at 10:22
1
  • 1
    I fear without first clearing the held broken packages this might not better but worse the situation. Commented Aug 21, 2017 at 10:25

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.