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

<p>Try this command:</p>

<pre><code>sudo phpenmod pdo_mysql
</code></pre>

<p>If it says it cant find the package, install this:</p>

<pre><code>sudo apt-get install php7.2-mysql
</code></pre>

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

<pre><code>;extension=pdo_mysql
</code></pre>

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

<pre><code>sudo phpenmod pdo_mysql
</code></pre>

<p>Restart apache. Good day.</p>

CC BY-SA 3.0
2018-03-21T07:58:02.920Z
2018-03-21T07:58:02.920Z
Dan Zuzevich
<p>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?</p>

CC BY-SA 3.0
2017-11-01T17:09:17.790Z
Do you have https://secure.php.net/manual/en/ref.pdo-mysql.php installed?
Brad Bell
<database><craft3><cli>
failed: could not find driver
# failed: could not find driver

(Asked by: username_0 on 2017-11-01)

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?

**Tags:** database, craft3, cli
> **Comments:**
> **username_1**: Do you have https://secure.php.net/manual/en/ref.pdo-mysql.php installed?  

---

## 1 answers

### Answer by username_2 on 2018-03-21. Score: 2

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.


---

