【问题标题】:php artisan migrate command error : could not find driverphp artisan migrate 命令错误:找不到驱动程序
【发布时间】:2019-01-17 13:36:07
【问题描述】:

我的操作系统是windows

Illuminate\Database\QueryException : 找不到驱动程序(SQL: select * from information_schema.tables where table_schema = blog and table_name = migrations)

  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.

【问题讨论】:

    标签: laravel laravel-5.6


    【解决方案1】:

    首先你需要启动你的mysql服务器 然后检查您的 mysql 的 env 配置,我认为您的密码不是 root,但您将 root 输入密码。 有时密码为空。请检查一下。

    【讨论】:

    • 谢谢@Abdi,我终于解决了。问题出在 php.ini 中(在 php 文件夹中)。我刚刚替换: ;extension=pdo_mysql 到 extension=pdo_mysql
    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 2018-10-29
      • 2023-03-27
      • 2016-01-13
      • 2016-07-30
      • 2017-09-27
      • 2019-10-29
      • 2018-08-15
      • 2014-04-23
      • 1970-01-01
      相关资源
      最近更新 更多