【发布时间】:2021-08-26 02:04:44
【问题描述】:
我正在尝试将数据库与我的 Laravel 7 应用程序连接,但每次点击 php artisan migrate 时都会出现以下错误。
我已将我的 .env 文件连接如下:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=test
DB_USERNAME=root
DB_PASSWORD=""
照亮\数据库\查询异常
could not find driver (SQL: select * from information_schema.tables where table_schema = test and table_name = migrations and table_type = 'BASE TABLE')
at 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|
+32 vendor frames
33 artisan:37
Illuminate\Foundation\Console\Kernel::handle()
我尝试了几种方法,包括取消注释 php.ini 文件中的扩展名,但没有任何改变!
【问题讨论】:
-
去掉密码中的引号。只写
DB_PASSWORD= -
是的,我这样做了,但它没有解决问题:(
-
已有解决方案。您可能会在这里看到:stackoverflow.com/questions/62972936/… 这些可能会有所帮助。
标签: php mysql laravel laravel-7