struct st_mysql_client_plugin *mysql_load_plugin(MYSQL *mysql, const char *name, int type, int argc, ...)


Loads a MySQL client plugin, specified by name and type. An error occurs if the type is invalid or the plugin cannot be loaded.

It is not possible to load multiple plugins of the same type. An error occurs if you try to load a plugin of a type already loaded.

Specify the parameters as follows:

This function was added in MySQL 5.5.7.

Another way to cause plugins to be loaded is to set the LIBMYSQL_PLUGINS environment variable to a semicolon-separated list of plugin names. For example:

shell> export LIBMYSQL_PLUGINS="myplugin1;myplugin2"

Plugins named by LIBMYSQL_PLUGINS are loaded when the client program calls mysql_library_init(). No error is reported if problems occur loading these plugins.

Return Values

A pointer to the plugin if it was loaded successfully. NULL if an error occurred.


To check for errors, call the mysql_error() or mysql_errno() function. See Section, “mysql_error()”, and Section, “mysql_errno()”.

MYSQL mysql;

if(!mysql_load_plugin(&mysql, "myplugin",
    fprintf(stderr, "Error: %s\n", mysql_error(&mysql));
See Also

See also Section, “mysql_load_plugin()”, Section, “mysql_error()”, Section, “mysql_errno()”.