Course contentsShow
← Databases & SQL
Lesson 1017 of 1,9539. MySQL and MariaDB EcosystemsFree lesson

Plugin Management

Load and unload server plugins dynamically for feature-specific enhancements.

In this lesson, you will learn how to extend the functionality of your MySQL or MariaDB server by dynamically loading and unloading plugins without needing a full service restart.

The Power of Dynamic Plugins

Plugins are modular components that provide additional features to the database server, such as new authentication methods, audit logging, or specialized storage engines. Instead of recompiling the server or scheduling downtime for a restart, you can use the SQL interface to "plug in" or "remove" these capabilities on the fly. This is essential for maintaining high availability while adapting the database to evolving security or performance requirements.

Loading and Unloading

When you load a plugin, the server reads the corresponding library file (usually a .so or .dll file found in your plugin_dir) and registers its features.

To load a plugin at runtime, use the INSTALL PLUGIN statement. For example, if you wanted to load the validate_password plugin to enforce stronger security policies, you would execute:

INSTALL PLUGIN validate_password SONAME 'validate_password.so';

Once the command executes successfully, the server integrates the plugin’s capabilities immediately. If you no longer need the feature or want to replace it, you can unload it just as easily:

UNINSTALL PLUGIN validate_password;

Verification and Management

You can check which plugins are currently active by querying the plugins table within the information_schema database. This helps you audit your environment to ensure only authorized components are running:

SELECT plugin_name, plugin_status 
FROM information_schema.plugins 
WHERE plugin_status = 'ACTIVE';

Important Considerations

While dynamic loading is convenient, keep in mind that INSTALL PLUGIN only affects the current running instance. If your server crashes or restarts, the plugin will not load automatically unless you have also specified it in your server configuration file (e.g., my.cnf or my.ini) using the plugin-load directive. Always ensure your library files are located in the designated plugin_dir before attempting to install them.

Key Takeaway: Dynamic plugin management allows you to enhance server functionality in real-time, providing a flexible way to add or remove features without interrupting database operations.