Craft CMS 3 - I have used the CLI ./craft setup script to set the database connection on my local machine. I setup a MySQL connection, but when it attempts to validate my credentials, I get "failed: could not find driver". However, when I make a direct MySQL CLI connection using the same credentials, it works just fine. Why can Craft CMS not connect to my local database?


1 Answer 1


For anyone from the future, this worked for me utilizing Ubuntu 16.0.4 with PHP7.2:

Try this command:

sudo phpenmod pdo_mysql

If it says it cant find the package, install this:

sudo apt-get install php7.2-mysql

Check your active php.ini file for this line(my active .ini was located n /etc/php/7.2/apache2/php.ini):


If it has a semicolon before it, remove it, and then save. For good measure, run this again:

sudo phpenmod pdo_mysql

Restart apache. Good day.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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