Friday, 19 December 2014

MySQL Plugins Installation, Uninstalling Plugins And Types Of Installations.

Through this post I would like to walk you through Plugin installation, Uninstalling Plugins and various types of plugin installations.

MySQL provides a great flexibility to its users to control and configure their DB servers based on their own requirements.

MySQL 5.1 and up supports a plugin API that enables creation of server components. Plugins can be loaded at server startup, or loaded and unloaded at runtime without restarting the server.

Go through MySQL Plugin API for more information.

PREREQUISITE : Make sure that you have copied required plugin libraries to the plugin directory, and corresponding plugin configuration parameters have been added to configuration file.

Coming to the installation types, we can do plugin installation in the following two ways :

1)  Plugins installed with the INSTALL PLUGIN statement, which is a permanent method of installing a plugin.

    A plugin that is located in a plugin library file can be loaded at run time with the INSTALL PLUGIN statement. The statement also registers the plugin in the mysql.plugin table to cause the server to load it on subsequent restarts. For this reason, INSTALL PLUGIN requires the INSERT privilege for the mysql.plugin table.

    EX : mysql> INSTALL PLUGIN plugin_name SONAME 'shared_library_name’;
   
    This is the statement to be used to install a plugin. As mentioned above in “PREREQUISITE” section make sure that plugin library placed on the plugin directory provided in the configuration file.

    Login to the DB instance and run the above statement. Suppose If you are installing LDAP authentication plugin then we have to place “auth_ldap.so” in the plugin directory and execute the following statement.

        mysql> INSTALL PLUGIN auth_ldap SONAME 'auth_ldap.so';
    
    INSTALL PLUGIN also registers the plugin by adding a line that indicates the plugin name and library file name to the mysql.plugin table. At server startup, the server loads and initializes any plugin that is listed in the mysql.plugin table.

    Once if the plugin installation is done, then you can go ahead and add the plugin specific configuration parameters to configuration file.

    To check the list of installed plugins run “show plugins;” it will display the list of plugins running on the Instance.
   
    For more information go through Installing Plugins.

2) The Second way of doing it is load the plugin at the startup of MySQL instance itself using --plugin_name[=value] startup option.

     A plugin that is located in a plugin library file can be loaded at server startup with the --plugin-load option. Normally, the server enables the plugin at startup, although this can be changed with the --plugin_name option.

    The option value is a semicolon-separated list of name=plugin_library pairs. Each name is the name of the plugin, and plugin_library is the name of the shared library that contains the plugin code. If a plugin library is named without any preceding plugin name, the server loads all plugins in the library. Each library file must be located in the directory named by the plugin_dir system variable.

    This option does not register any plugin in the mysql.plugin table. For subsequent restarts, the server loads the plugin again only if --plugin-load is given again. That is, this option effects a one-time installation that persists only for one server invocation.

    If the server knows about a plugin when it starts (for example, because the plugin is named using a --plugin-load option or registered in the mysql.plugin table), the server loads and enables the plugin by default. It is possible to control activation for such a plugin using a --plugin_name[=value] startup option named after the plugin.

    EX : Suppose If you are installing LDAP authentication plugin then we have to place “auth_ldap.so” in the plugin directory and add “--plugin-load=auth_ldap.so” configuration parameter to configuration file.

    For more information go through Installing Plugins.

Uninstalling Plugins:

    A plugin known to the server can be uninstalled to disable it at run time with the UNINSTALL PLUGIN statement. The statement unloads the plugin and removes it from the mysql.plugin table if it is registered there. For this reason, UNINSTALL PLUGIN statement requires the DELETE privilege for the mysql.plugin table. With the plugin no longer registered in the table, the server will not load the plugin automatically for subsequent restarts.

    UNINSTALL PLUGIN can unload plugins regardless of whether they were loaded with INSTALL PLUGIN or --plugin-load.

    UNINSTALL PLUGIN is subject to these exceptions:

            It cannot unload plugins that are built in to the server. These can be identified as those that have a library name of NULL in the output from INFORMATION_SCHEMA.PLUGINS or SHOW PLUGINS.

            It cannot unload plugins for which the server was started with --plugin_name=FORCE_PLUS_PERMANENT, which prevents plugin unloading at runtime. These can be identified from the LOAD_OPTION column of the INFORMATION_SCHEMA.PLUGINS table.

    For more information go through Installing & Un installing Plugins.

MySQL InternalsMySQL HighAvailabilityMySQL Performance TuningMySQL Query OptimizationMySQL performanceMySQL FabricMySQL HAMySQL InstallationMySQL UpgradeInnoDB Performance TuningInnoDB Buffer Pool SizeMySQL Performance TuningMySQL ClusterMySQL Latest NewsNews and EventsMySQL Customers