How to uninstall and revert to Drupal core MySQL driver?

Created on 18 January 2024, 10 months ago
Updated 8 July 2024, 4 months ago

Problem/Motivation

My Drupal site is running MySQL 5.7 now, so I figured I could uninstall this module, but when doing so I encounter the following error:

Error: Class "Drupal\Driver\Database\mysql\Connection" not found in /app/docroot/core/lib/Drupal/Core/Database/Database.php on line 451 #0 /app/docroot/core/lib/Drupal/Core/Database/Database.php(194): Drupal\Core\Database\Database::openConnection('default', 'default')

Is there a way to safely uninstall the module and revert back to the core driver? In my settings.php file I'm already using the Drupal\\Core\\Database\\Driver\\mysql database namespace.

Steps to reproduce

Remove module via composer remove drupal/mysql56

Thanks!

🐛 Bug report
Status

Closed: works as designed

Version

1.7

Component

Code

Created by

🇬🇧United Kingdom djvern

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

Comments & Activities

  • Issue created by @djvern
  • 🇮🇳India samir_shukla bareilly

    Hi, I was unable to reproduce the issue and was able to successfully remove the module via composer.Below is my settings.php file you can compare and check whether there is any issue with it.

    $databases['default']['default'] = array (
      'database' => 'samdr102',
      'username' => 'root',
      'password' => 'root',
      'prefix' => '',
      'host' => 'localhost',
      'port' => '3306',
      'isolation_level' => 'READ COMMITTED',
      'driver' => 'mysql',
      'namespace' => 'Drupal\\mysql\\Driver\\Database\\mysql',
      'autoload' => 'core/modules/mysql\\src\\Driver\\Database\\mysql\\',
    );
  • 🇬🇧United Kingdom djvern

    @samir I can confirm this did work for me, thanks. I had the database namespace set in my main settings.php file that was overriding what I had in a local settings file.

  • Status changed to Closed: works as designed 4 months ago
  • 🇬🇧United Kingdom djvern
Production build 0.71.5 2024