php artisan migrate command error : could not find driver

php artisan migrate command error : could not find driver

我的os是windows

Illuminate\Database\QueryException : 找不到驱动程序 (SQL: select * 来自 information_schema.tables 其中 table_schema = 博客和 table_name = 迁移)

  at E:\Programme\Laravel Lab\blog\vendor\laravel\framework\src\Illuminate\Database\Connection.php:664
    660|         // If an exception occurs when attempting to run a query, we'll format the error
    661|         // message to include the bindings with SQL, which will make this exception a
    662|         // lot more helpful to the developer instead of just the database's errors.
    663|         catch (Exception $e) {
  > 664|             throw new QueryException(
    665|                 $query, $this->prepareBindings($bindings), $e
    666|             );
    667|         }
    668|

  Exception trace:

  1   PDOException::("could not find driver")
      E:\Programme\Laravel Lab\blog\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:68

  2   PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=blog", "root", "root", [])
      E:\Programme\Laravel Lab\blog\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:68

  Please use the argument -v to see more details.

首先你需要启动你的 mysql 服务器 然后检查你的 mysql 的环境配置,我认为你的密码不是 root,但你把 root 放在密码中。 有时密码为空。请检查一下。

我遇到了同样的问题,一直检查 xampp 中的 php.ini 文件,其中 extension = pdo_mysql 未注释。但是在输入 php --ini 之后,结果是我在迁移时使用了 C 中的一个文件:\ php \ php.ini 并且在取消注释之后我能够迁移。