◆エラー内容
PS C:UsersuserDocumentsMEGASOHOMENTAsrcsales> php artisan migrate
IlluminateDatabaseQueryException : could not find driver (SQL: select * from information_schema.tables where table_schema = sale and table_name = migrations and table_type = 'BASE TABLE')
at C:UsersuserDocumentsMEGASOHOMENTAsrcsalesvendorlaravelframeworksrcIlluminateDatabaseConnection.php:669
665| // If an exception occurs when attempting to run a query, we'll format the error
666| // message to include the bindings with SQL, which will make this exception a
667| // lot more helpful to the developer instead of just the database's errors.
668| catch (Exception $e) {
> 669| throw new QueryException(
670| $query, $this->prepareBindings($bindings), $e
671| );
672| }
673|
Exception trace:
1 DoctrineDBALDriverPDOException::("could not find driver")
C:UsersuserDocumentsMEGASOHOMENTAsrcsalesvendordoctrinedballibDoctrineDBALDriverPDOConnection.php:31
2 PDOException::("could not find driver")
C:UsersuserDocumentsMEGASOHOMENTAsrcsalesvendordoctrinedballibDoctrineDBALDriverPDOConnection.php:27
Please use the argument -v to see more details.
PS C:UsersuserDocumentsMEGASOHOMENTAsrcsales>
.envのデータベース名もあっているし、データベースも作成されている。どうもPDOが接続できないようです。
◆原因
php格納場所を where コマンドで確認
C:UsersuserDocumentsMEGASOHOMENTAsrcsales>where php
C:phpphp.exe
cd で 該当ディレクトリで移動し php.ini を開く

phpinfoはブラウザ経由で見ましたが、extension=pdo_mysql (PDO)がPHPで指定されていませんでした
◆対策
php.ini を変更します
extension=pdo_mysql
を生かしましょう
これで無事にマイグレーションできました

