这是我得到的错误:
Illuminate\Database\QueryException
could not find driver (Connection: mysql, SQL: select exists (select 1 from information_schema.tables where table_schema = 'fitnessapp' and table_name = 'migrations' and table_type in ('BASE TABLE', 'SYSTEM VERSIONED')) as `exists`)
at vendor\laravel\framework\src\Illuminate\Database\Connection.php:825
821▕ $this->getName(), $query, $this->prepareBindings($bindings), $e
822▕ );
823▕ }
824▕
➜ 825▕ throw new QueryException(
826▕ $this->getName(), $query, $this->prepareBindings($bindings), $e
827▕ );
828▕ }
829▕ }
1 vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:66
PDOException::("could not find driver")
2 vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:66
PDO::__construct()
我启用了正确的驱动程序,如下所示: 扩展名=pdo_mysql
并且我已正确配置 .env 文件以匹配我在 phpmyadmin 页面中创建的数据库中的数据。
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=fitnessapp
DB_USERNAME=root
DB_PASSWORD=
我需要安装其他东西吗(我已经尝试重新创建 laravel 项目,但我得到了同样的错误)如何修复此错误?
您需要确保安装了 PHP 扩展“PDO”。 Laravel 不提供 PHP 安装。我假设您使用的是 Windows,这里是如何安装它:How do I install PDO drivers for PHP on Windows?