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?
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):
;extension=pdo_mysql
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.