[Solved] artisan migration error “Class ‘DoctrineDBALDriverPDOMySqlDriver’ not found”,
When trying to run a migration I get the error Artisan migration
Class 'DoctrineDBALDriverPDOMySqlDriver' not found
I have read the questions here and also see the notes to add:
doctrine/dbal": "~2.3 in the requires section of composer.json
However, I don’t understand what has happened. I created table a few days ago with no issue.
I can’t figure out what to do after adding that dependency in composer.son.
I don’t want to accidentally update any other packages.
doctrine/dbal dependency needs to be added to your
composer require doctrine/dbal
For more information check laravel #Modifying Columns
In my case both composer install and composer install was not working giving a same error “Class ‘DoctrineDBALDriverPDOMySqlDriver’ not found”,
The changes that i made to make this workable are given below
composer.json file changed
this changed with
then run the command
You have to downgrade the current version, this is what worked for me:
composer require doctrine/dbal:2.*
If you using doctrine 3, downgrade to
"doctrine/dbal": "^2.10.3"(I don’t know does laravel updated migration tools for doctrine 3. If do, you should update laravel tools).
They renamed class and
DoctrineDBALDriverPDOMySqlDriver not exists
Who ever is facing this issue while having
doctrine/dbal”: “3.0” aleady required:
downgrade it back to
If you still face issues for example getting
LaravelPassportBridgeAccessToken::__toString() must not throw an
You should require a prev version of lcobucci/jwt. It just got auto updated to 3.4, which caused these issues for me.
Took me around 3-4 hours to track everything down to this.
Hope it helps someone else too.
composer require lcobucci/jwt 3.3.3
As already said, use
composer require doctrine/dbal, if for whatever reason that doesn’t work, use a lower version like
composer require doctrine/dbal:^2.12.1 and then run
composer dumpautoload -o.
This message shows up if you want to edit column in a database.
To solve it do:
- and use the
composer require doctrine/dbalcommand
It will install your missing packages like PDOMySql.
Delete vendor folder and run
If you are using laravel 7 then please downgrade the “doctrine/dbal”
and then run
It works for me
Can you share your current composer.json?
After composer.json update, you can execute composer install. It won’t update existing packages (because of generated composer.lock), it’ll only install new ones.
What has changes since your last migration?
It’s the same project in the same directory? If so, it should be there.
OK thanks so much for the help.
Stupidly, I had read that to do some other operations, that missing driver is called and I had tried to run a migration the other day to change a column name and what I completely forgot was that subsequent migrate runs are trying to still run that bad one. Once i remembered and deleted the update column name migration, my add table migration ran fine. With a project due in a few weeks, no package updates for me!!
I saw this:
To rename a column, you may use the renameColumn method on the Schema builder. Before renaming a column, be sure to add the doctrine/dbal dependency to your composer.json file:
it maybe work.
if you are using PhpStorm editor for your project open Terminal tab and run this command:
composer require doctrine/dbal
also you can open command window in root of your project and run that command.