【发布时间】:2020-07-08 15:37:25
【问题描述】:
我是 Laravel 的新手,正在尝试学习在线教程。我到了需要在终端中运行php artisan migrate 的地步,我收到以下错误:
Illuminate\Database\QueryException
could not find driver (SQL: select * from information_schema.tables where table_schema = some_db and table_name = migrations and table_type = 'BASE TABLE')
at C:\xampp\htdocs\social\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|
1 C:\xampp\htdocs\social\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
PDOException::("could not find driver")
2 C:\xampp\htdocs\social\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=some_db", "root", "", [])
我已经尝试了所有可以在这里找到的解决方案,并且我已经进入了我的php.ini 文件以启用不同的扩展,但似乎没有任何效果。我找到了一个解决方案,说尝试运行sudo apt-get install php-mysql,但我使用的是 Windows,所以这不是我的选择。非常感谢您对此事的任何帮助!
【问题讨论】:
-
首先你是否已经在 root 上创建了 .env ?你有安装mysql吗?你跑了吗
php artisan clear -
我有 laravel 包附带的 .env 文件,我有与 phpmyadmin 一起使用的 mysqli。我刚刚跑了
php artisan clear,但它并没有解决我的问题。