[Resolved] php artisan migrate Illuminate\Database\QueryException

During Laravel development on Windows 10, you may have seen an error while executing the PHP artisan migration command on CMD

$ php artisan migrate:install

Illuminate\Database\QueryException

could not find driver (SQL: create table `migrations` (`id` int unsigned not null auto_increment primary key, `migration` varchar(255) not null, `batch` int not null) default character set utf8mb4 collate ‘utf8mb4_unicode_ci’)

1 …\Laravel\blog\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
PDOException::(“could not find driver”)

2 …\Laravel\blog\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
PDO::__construct()

 

XAMPP tool to run PHPMyAdmin on localhost

Solution

To resolve this issue, you need to enable the php_pdo_mysql.dll Extention into the php.ini file.

Step 1) Update php.ini @ C:\php folder

Open the C:\php\php.ini and add the following line

extension=php_pdo_mysql.dll

 

Step 2) Update php.ini @ xampp folder

Open the C:\xampp\php\php.ini file and add the following extension

extension=php_pdo_mysql.dll

 

Step 3) Restart the XAMPP

Now open the XAMPP control panel, then restart the Apache and MySQL

 

Now, you are ready to re-run the “php artisan migrate”

Hope it helps 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *