Manually disable a module
The Drupal 7 system table data is now stored in the config table in Drupal 8 against the core.extension parameter.

Solution 1: Update configuration

You can run the following code using drush eval or may be using the Devel module's provision to Execute PHP Code.

// Read the configuration.
$module_data = \Drupal::config('core.extension')-&gt;get('module');

// Unset the modules you do not need.
unset($module_data['MODULE_NAME']);

// Write the configuration.
\Drupal::configFactory()-&gt;getEditable('core.extension')-&gt;set('module', $module_data)-&gt;save();


You can do this all in a quick one-liner with drush.

drush eval "\$module_data = \Drupal::config('core.extension')-&gt;get('module'); unset(\$module_data['MODULE_NAME']); \Drupal::configFactory()-&gt;getEditable('core.extension')-&gt;set('module', \$module_data)-&gt;save();"


Solution 2: Edit config table if you cannot execute PHP

If the site is broken because of the problematic module and you can't even run PHP code, then may be you can edit the config table directly.

In the row in the config table where name = "core.extension" and edit the BLOB column data. The data is a serialized PHP array where you have to remove the module you want to get rid of from the module key of the configuration.

Solution 3: Fast and dirty solution


Remove the module from the file system
Truncate the table cache_config


However, this solution might result in messages saying the module does not exist in file system which mean something is wrong. But at least the broken module gets disabled and you can access your site in most of the cases.

Clearing Cache

Sometimes you might have to clear cache after following the above steps. Read this handy documentation on how to clear cache.