7

In Windows I use Xampp. I have tried to install MySQL from the command-line and I can access MySQL through workbench software.

Now if I try to run Wordpress on my computer, I get an error that "Your PHP installation appears to be missing the MySQL extension which is required by WordPress."

Someone help me to install MySQL extension(s) for my installation. If I try to install php-mysql:

 $ sudo apt-get  install php-mysql

then I get this error:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package php-mysql

Please someone help me to install MySQL extension. Most of the blogposts I have seen have this trick, but it's not working for me. The Ubuntu software center shows me that both MySQL server and client are both as installed.

4 Answers 4

15

The package is called php5-mysql in Ubuntu, not php-mysql.

1
  • 1
    Or it could be also this one php5.6-mysql Now you can get that adding this repository: sudo add-apt-repository ppa:ondrej/php, sudo apt-get update, sudo apt-get install php5.6-mysql
    – dani24
    Dec 27, 2016 at 14:42
4

Easiest way to install LAMP on Ubuntu is using an APT task:

sudo apt-get install lamp-server^

The caret (^) is not a typo.

It will select all the relevant packages for you. For your specific case is Dennis right, you're just missing the PHP5-MySQL bindings which you were installing with the wrong package name. Anyway, the task will make sure you'll have most common packages, including this one.

1
1

If you do not know the exact name of the package you want to install you can run

sudo apt-get update
apt-cache search mysql

This also holds for other packages than mysql. For instance apt-cache search firefox.

Once the options listed, you can select your choice.

0

First you check for available versions of software:

sudo apt-cache search php-mysql

Then install the latest version from the list printed out from the previous command:

sudo install php7.4-mysql

If there was no package, try the following command and redo the above process:

sudo add-apt-repository universe
1
  • Error: 'universe' invalid
    – Felix Eve
    Oct 21, 2022 at 14:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .