A very annoying upgrade issue I encountered when using the configuration of a < 9.4 site for a 9.4 website:

[error]  Drupal\Core\Config\ConfigImporterException: There were errors validating the config synchronization.
Unable to uninstall the MySQL module because: The module 'MySQL' is providing the database driver 'mysql'.. in Drupal\Core\Config\ConfigImporter->validate() (line 756 of /app/web/core/lib/Drupal/Core/Config/ConfigImporter.php).

My solution

Add the following line to the module key in your core.extension.yml:

  mysql: 0 

Alternative solution

And so the solution is to roll back the code to Drupal 9.3, do your installation from configuration, and then run the database updates, export configuration, and commit the result.

For example:

git checkout <commit-hash-of-earlier-composer-lock>
composer install
drush -y site:install drutopia --existing-config
git checkout main
composer install
drush -y updb
drush -y cex
git status # Review what is here; git add -p can also help
git add config/
git commit -m "Apply configuration updates from Drupal 9.4 upgrade"

The system update enable_provider_database_driver is the post-update hook that is doing the work here to "Enable the modules that are providing the listed database drivers." Pretty cool feature and a strong reminder to always, always run database updates and commit any configuration changes immediately after any code updates!

Credits: https://agaric.coop/blog/drupal-94-installation-existing-configuration-fails-because-unable-uninstall-mysql-module


Saved you some valuable time?

Buy me a drink 🍺 to keep me motivated to create free content like this!