Listing Enabled Modules Using phpMyAdmin

Category
Drupal Version
Tags

Below is SQL code that prints out SQL statements that you can copy and paste back into phpMyAdmin (or any MySQL management tool that can connect to your Drupal database).  These statements will help you get a list of enabled modules, when you need to check multiple Drupal 6 or 7 databases at one time.

With thanks to Aaron Brown on DBA.stackexchange for the basic code.

Be careful to copy the backquotes/backticks (that look a little like left-leaning apostrophes) exactly.


SELECT CONCAT('SELECT \`name\` FROM ', schema_name, '.\`system\` WHERE \`status\` =\'1\' AND \`type\` =\'module\' ORDER BY \`name\` ASC;')
FROM information_schema.schemata
WHERE schema_name NOT IN ('information_schema','mysql','performance_schema','test', 'excluded_database');

This will print out a series of SQL statements, like the one below, which you could paste into the SQL tab of phpmyAdmin, in order to create lists of enabled modules.  This can be helpful if you don't have ssh access to your site, but still want an easy way to get a simple text list of enabled modules.

SELECT `name` FROM ms6_sample1.`system` WHERE `status` ='1' AND `type` ='module' ORDER BY `name` ASC; SELECT `name` FROM ms7_sample2.`system` WHERE `status` ='1' AND `type` ='module' ORDER BY `name` ASC;