Error: Class "Drupal\mysql\Driver\Database\mysql\TransactionManager" not found

Created on 22 December 2023, about 1 year ago
Updated 4 July 2024, 6 months ago

Problem/Motivation

I upgraded from Drupal 10.1.7 to Drupal 10.2.0. When I try to clear the cache (either via the ui or via drush), I get the following error message:

The website encountered an unexpected error. Try again later.

Error: Class "Drupal\mysql\Driver\Database\mysql\TransactionManager" not found in Drupal\mysql\Driver\Database\mysql\Connection->driverTransactionManager() (line 488 of core/modules/mysql/src/Driver/Database/mysql/Connection.php).
Drupal\Core\Database\Connection->transactionManager() (Line: 1412)
Drupal\Core\Database\Connection->inTransaction() (Line: 78)
Drupal\Core\Database\Query\Truncate->__toString() (Line: 51)
Drupal\Core\Database\Query\Truncate->execute() (Line: 322)
Drupal\Core\Cache\DatabaseBackend->deleteAll() (Line: 445)
drupal_flush_all_caches() (Line: 205)
Drupal\admin_toolbar_tools\Controller\ToolbarController->flushAll()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 53)
Asm89\Stack\Cors->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 704)
Drupal\Core\DrupalKernel->handle() (Line: 19)

The only way for me to get the cache cleared is by putting the code from TransactionManager.php (starting the "use" on line 7 untill the end) into Connection.php. This, of course, is not the way to go. It, however, showed me, that without the error the cache can be cleared and the system works again.

PHP version 8.1.24
MariaDB 10.4.27-MariaDB-cll-lve
Apache/2

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ’¬ Support request
Status

Closed: works as designed

Version

10.2 ✨

Component
MySQL driverΒ  β†’

Last updated 2 days ago

Created by

πŸ‡³πŸ‡±Netherlands basby

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @basby
  • Status changed to Postponed: needs info about 1 year ago
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    Is the MySQL module enabled?

  • πŸ‡³πŸ‡±Netherlands basby

    No larowlan, the MySQL module is not enabled. It seems that this is correct, since for MariaDB the module is only needed when the MariaDB version is lower than MariaDB 10.3.7. I have 10.4.27 installed.

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    Pretty sure it needs to be enabled

  • πŸ‡³πŸ‡±Netherlands basby

    I have installed the MySQL module as you suggested and the systems works!
    larowlan, thank you so much!

    I misinterpreted the info-page of project mysql56. That's why I thought the MySQL module was not necessary.

    For those who experience the same issue: I had to keep the code from TransactionManager.php in Connection.php while installing the MySQL module. Only after the installation I could remove the code.

  • Status changed to Closed: works as designed 12 months ago
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    πŸ‘

  • πŸ‡ΊπŸ‡ΈUnited States hockey2112

    This fixed the same issue for me today. To clarify just a bit, the TransactionManager.php and Connection.php files are in code/modules/mysql/src/Driver/Database. As basby stated, you literally just copy everything from line 7 until the end of the file, and paste it at the end of the Connection.php file. I then cleared cache successfully and then reverted the changes in Connection.php back to the original version of that file.

  • πŸ‡ͺπŸ‡ΈSpain guardiola86

    Is there a proper way to fix this? That's not really a solution.

Production build 0.71.5 2024