【问题标题】:Laravel 5.8 Class 'Doctrine\DBAL\Driver\PDOMySql\Driver' not found未找到 Laravel 5.8 类“Doctrine\DBAL\Driver\PDOMySql\Driver”
【发布时间】:2021-04-20 00:11:59
【问题描述】:

目标:使用 laravel 迁移更改 MySQL 中的列,但是会引发以下错误

要使用迁移更改 mysql 表中的列,需要安装“doctrine / dbal”依赖项。阅读 [https://laravel.com/docs/5.8/migrations#modifying-columns][1]

旁边链接上的文档

laravel 5.8 选择错误$ composer require doctrine/dbal

问题

    $ php artisan migrate
         Migrating: 2021_01_14_031415_my_chage_migrate

   Symfony\Component\Debug\Exception\FatalThrowableError  : Class 'Doctrine\DBAL\Driver\PDOMySql\Driver' not found    
  at ...\vendor\laravel\framework\src\Illuminate\Database\MySqlConnection.php:65
    61|      * @return \Doctrine\DBAL\Driver\PDOMySql\Driver
    62|      */
    63|     protected function getDoctrineDriver()
    64|     {
  > 65|         return new DoctrineDriver;
    66|     }
    67|
    68|     /**
    69|      * Bind values to their parameters in the given statement.

  Exception trace:

【问题讨论】:

  • 嗨安德烈,你有没有在你的项目上运行composer install。您能否将 composer.json 代码添加到您的问题和迁移文件中

标签: laravel doctrine-orm migration


【解决方案1】:

解决方案:

  1. $ composer remove doctrine/dbal
  2. $ composer require doctrine/dbal:2.*

我希望它可以帮助某人,祝你好运 ;)

【讨论】:

  • 在 laravel 7.30.4 上与学说/dbal (2.13.0) 相同的问题,它不能解决我
【解决方案2】:

dotring/dbal 2.12.1 是最后一个稳定版本;

1.composer require doctrine/dbal:2.12.1

2.composer update

【讨论】:

    猜你喜欢
    • 2021-10-11
    • 2021-02-28
    • 2016-02-22
    • 2016-01-05
    • 2013-06-02
    • 1970-01-01
    • 2021-03-27
    • 2019-04-04
    • 1970-01-01
    相关资源
    最近更新 更多