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

Created on 13 June 2023, about 1 year ago
Updated 24 October 2023, 11 months ago

Problem/Motivation

I am trying to move my drupal 8.9.2 from one server to another. But after moving all files & folders & import the DB I got this error after running drush cr.

PHP Fatal error:  Uncaught Error: Class 'Drupal\mysql\Driver\Database\mysql\Connection' not found in /var/www/html/core/lib/Drupal/Core/Database/Database.php:374
Stack trace:
#0 /var/www/html/core/lib/Drupal/Core/Database/Database.php(169): Drupal\Core\Database\Database::openConnection()
#1 [internal function]: Drupal\Core\Database\Database::getConnection()
#2 /var/www/html/core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php(79): call_user_func_array()
#3 /var/www/html/core/lib/Drupal/Component/DependencyInjection/Container.php(173): Drupal\Component\DependencyInjection\PhpArrayContainer->createService()
#4 /var/www/html/core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php(212): Drupal\Component\DependencyInjection\Container->get()
#5 /var/www/html/core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php(62): Drupal\Component\DependencyInjection\PhpArrayContainer->resolveServicesAndParameters()
#6 in /var/www/html/core/lib/Drupal/Core/Database/Database.php on line 374

Server Details: Apache: 2.4.57, PHP: 7.4.33, MySQL: 8.0.25

Steps to reproduce

For me it was after moving all the files & folders & import the DB. The current server PHP version 7.4 & MySQL 8

Proposed resolution

I tried to comment out 'namespace' => 'Drupal\\mysql\\Driver\\Database\\mysql' in settings.php. But after this drush started working. But the site is still not opening.

What behavior were you expecting?

The site should open without any fatal error.

What happened instead?

The site is not opening, the error is
Error: Class "Drupal\Driver\Database\mysql\Connection" not found in Drupal\Core\Database\Database::openConnection() (line 463 of /var/www/html/core/lib/Drupal/Core/Database/Database.php)

Additional Note:

Can Drupal 8.9.2 run on MySQL 8.0.25?

Release notes snippet

💬 Support request
Status

Closed: outdated

Version

8.9 ⚰️

Component
MySQL driver 

Last updated 5 days ago

Created by

🇮🇳India dasSouvik93

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

Comments & Activities

  • Issue created by @dasSouvik93
  • Status changed to Postponed: needs info about 1 year ago
  • 🇺🇸United States cilefen

    Drupal 8 is end of life and is unsupported here. This is a well-defined issue. I suggest searching.

  • Issue was unassigned.
  • Status changed to Closed: outdated 11 months ago
  • 🇳🇿New Zealand quietone New Zealand

    There has been no further discussion here for four months and @cilefen has provided a way forward.

    Since Drupal 8 is no longer supported, I am closing this issue.

Production build 0.71.5 2024