【问题标题】:Laravel 8.6 php artisan migrate not working (windows)Laravel 8.6 php artisan migrate 不工作(windows)
【发布时间】:2021-01-10 06:33:21
【问题描述】:

我运行了 php artisan 命令,它返回了这个。

PS C:\Users\15715\OneDrive\Desktop\laravel-tutorial\links> php artisan migrate

   Illuminate\Database\QueryException 

  could not find driver (SQL: select * from information_schema.tables where table_schema = links_development and table_name = migrations and table_type = 'BASE TABLE')

  at C:\Users\15715\OneDrive\Desktop\laravel-tutorial\links\vendor\laravel\framework\src\Illuminate\Database\Connection.php:671
    667▕         // If an exception occurs when attempting to run a query, we'll format the error
    668▕         // message to include the bindings with SQL, which will make this exception a    669▕         // lot more helpful to the developer instead of just the database's errors.  
    670▕         catch (Exception $e) {
  ➜ 671▕             throw new QueryException(
    672▕                 $query, $this->prepareBindings($bindings), $e
    673▕             );
    674▕         }
    675▕

  1   C:\Users\15715\OneDrive\Desktop\laravel-tutorial\links\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
      PDOException::("could not find driver")

  2   C:\Users\15715\OneDrive\Desktop\laravel-tutorial\links\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
      PDO::__construct()

当我检查 PDO 时,它会在 PDO 上显示这一点。不确定这是否有帮助。

CHECK THIS! Unable to post it to the site directly.

【问题讨论】:

  • 你可以使用xampp并将laravel指向xampp

标签: php laravel pdo laravel-artisan


【解决方案1】:

只需做简单的事情,将您的 php 版本从 7.2 更新到 7.3 或 7.4,因为 laravel 7 需要 php 7.3 或更高版本并且还更新 mysql

【讨论】:

    【解决方案2】:

    我按照以下步骤解决了这个问题

    1. sudo apt-get install php7-mysql

    2. 打开 php.ini 文件并取消注释以下行

      ;extension=php_pdo_mysql.dll

      ;extension=pdo_mysql.so

    然后,重启 Apache 服务器

    【讨论】:

    • 对不起,我应该如何在 Windows 上执行 sudo apt-get install php7-mysql
    【解决方案3】:

    您最近是否升级了您的 php 版本,因为这看起来更像是一个 php 扩展错误。例如sudo apt-get install php7-mysql

    【讨论】:

    • 什么相当于 sudo apt-get install php7-mysql,对于 windows。最后,我的 PHP 版本已经是 PHP 7.4.8,所以这是必要的。
    • 好吧,既然你在 Windows 上,我猜你在使用 xamp 什么的。创建一个页面并回显 ,在该页面上找到 php.ini 及其所在位置,现在编辑该文件并找到 ;extension=php_pdo_mysql.dll;extension=pdo_mysql.so 并取消注释并重新启动 apache 服务器
    猜你喜欢
    • 2017-04-06
    • 2020-08-03
    • 2016-08-09
    • 2017-10-10
    • 2017-01-07
    • 1970-01-01
    • 2020-05-01
    • 2016-05-14
    • 2016-11-24
    相关资源
    最近更新 更多