php artisan migrate throwing [PDO Exception] Could not find driver - Using Laravel

You can use

sudo apt-get install php7-mysql

or

sudo apt-get install php5-mysql

or

sudo apt-get install php-mysql

This worked for me.


This worked for me:

sudo apt-get install php5-sqlite

This installed sqlite for php5, then I ran the php artisan migrate command again and worked perfectly.


You need to specifically enable the pdo_mysql plugin. Assuming you're using a standard PHP installation, then generally you would simply need to add this to your PHP.ini file:

extension=pdo_mysql.so

You need to ensure that this file exists in the extension directory though.

Adding pdo_pgsql.so doesn't help because that is for PostgreSQL.

Additionally, you should ensure that you restart the web-server after you make the changes to the PHP ini file, as the changes may not be reflected otherwise.