Magento Tutorials

How to Solve pdo_mysql Extension is Not Installed

What is “pdo_mysql extension is not installed”?

There are two possible scenarios when this error happens:

Scenario 1: When you install Magento 2, after Readiness Check, you will come to the step Add a Database. The message “pdo_mysql extension is not installed” appears on a red line.

pdo_mysql extension is not installed

Scenario 2: When you run the command php bin/magento setup:static-content:deploy from command line. The message shows:

pdo_mysql extension is not installed - command line

Why does this happen?

In PHP, there’s a module named php-mysql, which is very important to any PHP servers using mysql to be its database.

PHP needs this file to connect with mysql database. When this error occurs, it is likely that this module have not been installed or have been disabled.

How to solve it?

The module may be disabled. Run this command to enable it:

sudo phpenmod pdo_mysql

If the above method doesn’t work, then this module have not been installed.

In this case, install the module from your server’s command line (with sudo) (*):

sudo apt-get install php7.0-mysql

Note: In this guide we use PHP version 7.0. If you are using a different PHP version, please adjust the command line accordingly.

A knowledge craver who always strive to be wiser everyday.

Notify of
Inline Feedbacks
View all comments