◆エラー内容
PS C:\Users\user\Documents\MEGA\SOHO\MENTA\src\sales> php artisan migrate
Illuminate\Database\QueryException : 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:\Users\user\Documents\MEGA\SOHO\MENTA\src\sales\vendor\laravel\framework\src\Illuminate\Database\Connection.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 Doctrine\DBAL\Driver\PDOException::("could not find driver")
C:\Users\user\Documents\MEGA\SOHO\MENTA\src\sales\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php:31
2 PDOException::("could not find driver")
C:\Users\user\Documents\MEGA\SOHO\MENTA\src\sales\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php:27
Please use the argument -v to see more details.
PS C:\Users\user\Documents\MEGA\SOHO\MENTA\src\sales>
.envのデータベース名もあっているし、データベースも作成されている。どうもPDOが接続できないようです。
◆原因
php格納場所を where コマンドで確認
C:\Users\user\Documents\MEGA\SOHO\MENTA\src\sales>where php
C:\php\php.exe
cd で 該当ディレクトリで移動し php.ini を開く
phpinfoはブラウザ経由で見ましたが、extension=pdo_mysql (PDO)がPHPで指定されていませんでした
◆対策
php.ini を変更します
extension=pdo_mysql
を生かしましょう
これで無事にマイグレーションできました
0