I was creating a mirror copy of one of my WordPress installations recently and needed a way to disable all plugins. During the process of creating the development WordPress mirror there were issues so I needed to disable all WordPress plugins via MySQL since at the time I could not login to the WordPress admin. Below I will describe listing all of the active plugins with one MySQL command and then disabling all of the plugins with another MySQL command.

All of the active plugins are added to the option_name.active_plugins row of the wp_options table. Remember if you have modified the default prefix for your WordPress installation then your table names will be different so adjust accordingly. The active_plugins row is lists all of the plugins in one list and each time a new plugin is activated that list is updated. Make sure you copy the list before you remove it from the installation.

List All Active Plugins Using A Simple MySQL Command:

SELECT * FROM wp_options WHERE option_name = 'active_plugins';

The output of the above command will look something similar to the below where I show what it might look if only four plugins were active.

MySQL Output For Active Plugins:

|        38 |       0 | active_plugins | a:41:{i:0;s:39:"adsense-for-feeds/adsense-for-feeds.php";i:1;s:19:"akismet/akismet.php";i:2;s:29:"amazon-machine-tags/amtap.php";i:40;s:42:"yet-another-related-posts-plugin/yarpp.php";} | yes      |

Now that you have backed up the current active plugins you can go ahead and disable all of the active plugins by modifying the option_name.active_plugins field in MySQL. To empty this row in the options_name table issue the below command.

Disable All Active Plugins Using MySQL:

UPDATE wp_options SET option_value = '' WHERE option_name = 'active_plugins';

That is all of you have to do and all of your WordPress plugins will be disabled. You can enter the above commands by logging into MySQL server CLI or you can enter them into the phpMyAdmin “Run SQL query/queries on database” window. You can reach this window in phpMyAdmin by clicking on a database in the left navigation and then clicking the SQL tab. As you can see above all you are doing with the second command that disables all of the plugins is replacing the MySQL table field that stores all of the active plugins with nothing but a space.

High Performance MySQL: Optimization, Backups, Replication, and More (Paperback)

By (author): Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling

List Price: $49.99 USD
New From: $21.92 USD In Stock
Used from: $1.75 USD In Stock

Understanding MySQL Internals (Paperback)

By (author): Sasha Pachev

List Price: $49.99 USD
New From: $24.65 USD In Stock
Used from: $17.82 USD In Stock

Tags: , , , , , , , ,
Leave a Reply

*Type the letter/number combination in the abvoe field before clicking submit.