Table of Contents
- 4.1 Types of Plugins
- 4.2 Plugin API Characteristics
- 4.3 Plugin API Components
- 4.4 Writing Plugins
- 4.4.1 Overview of Plugin Writing
- 4.4.2 Plugin Data Structures
- 4.4.3 Compiling and Installing Plugin Libraries
- 4.4.4 Writing Full-Text Parser Plugins
- 4.4.5 Writing Daemon Plugins
- 4.4.6 Writing INFORMATION_SCHEMA Plugins
- 4.4.7 Writing Semisynchronous Replication Plugins
- 4.4.8 Writing Audit Plugins
- 4.4.9 Writing Authentication Plugins
- 4.4.10 Writing Password-Validation Plugins
- 4.4.11 Writing Protocol Trace Plugins
- 4.4.12 Writing Keyring Plugins
MySQL 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. The API is generic and does not specify what plugins can do. The components supported by this interface include, but are not limited to, storage engines, full-text parser plugins, and server extensions.
For example, full-text parser plugins can be used to replace or augment the built-in full-text parser. A plugin can parse text into words using rules that differ from those used by the built-in parser. This can be useful if you need to parse text with characteristics different from those expected by the built-in parser.
The plugin interface is more general than the older loadable function interface.
The plugin interface uses the
plugin table in
mysql database to record information about
plugins that have been installed permanently with the
INSTALL PLUGIN statement. This
table is created as part of the MySQL installation process.
Plugins can also be installed for a single server invocation with
--plugin-load option. Plugins installed this
way are not recorded in the
plugin table. See
Installing and Uninstalling Plugins.
MySQL supports an API for client plugins in addition to that for server plugins. This is used, for example, by authentication plugins where a server-side plugin and a client-side plugin cooperate to enable clients to connect to the server through a variety of authentication methods.
The MySQL source code contains internal documentation written using Doxygen. This documentation is useful for understanding how MySQL works from a developer perspective. The generated Doxygen content is available at https://dev.mysql.com/doc/index-other.html. It is also possible to generate this content locally from a MySQL source distribution using the instructions at Generating MySQL Doxygen Documentation Content.
The book MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings provides a wealth of detail about the plugin API. Despite the fact that the book's title refers to MySQL Server 5.1, most of the information in it applies to later versions as well.