INSTALL PLUGIN

Stai visualizzando una vecchia versione di questo article. Visualizza la versione più recente.

Sintassi

INSTALL PLUGIN nome_plugin SONAME 'libreria_plugin'

Spiegazione

Questa istruzione installa un plugin.

nome_plugin è il nome del plugin così come è definito nella struttura della dichiarazione del plugin nel file della libreria. I nomi dei plugin non sono case sensitive (non fanno distinzioni tra lettere maiuscole e lettere minuscole). Per favorire una compatibilità di massima, i nomi devono essere limitati alle lettere ASCII, cifre e underscore (_), perché sono utilizzati nei file sorgenti in C, nella riga di comando, nelle shell M4 e Bourne, e negli ambienti SQL.

libreria_plugin è il nome della libreria condivisa che contiene il codice del plugin. Nelle versioni di MariaDB precedenti alla 5.5.21 il nome dovrebbe includere l'estensione del nome del file (per esempio libmyplugin.so o libmyplugin.dll). A partire dalla 5.5.21, l'estensione può essere omessa (in questo modo è possibile utilizzare la stessa istruzione su differenti architetture).

The shared library must be located in the plugin directory (that is, the directory named by the plugin_dir system variable). The library must be in the plugin directory itself, not in a subdirectory. By default, plugin_dir is plugin directory under the directory named by the pkglibdir configuration variable, but it can be changed by setting the value of plugin_dir at server startup. For example, set its value in a my.cnf file:

[mysqld] plugin_dir=/path/to/plugin/directory

If the value of plugin_dir is a relative path name, it is taken to be relative to the MySQL base directory (the value of the basedir system variable).

INSTALL PLUGIN adds a line to the mysql.plugin table that describes the plugin. This table contains the plugin name and library file name.

As of MySQL 5.1.33, INSTALL PLUGIN causes the server to read option (my.cnf) files just as during server startup. This enables the plugin to pick up any relevant options from those files. It is possible to add plugin options to an option file even before loading a plugin (if the loose prefix is used). It is also possible to uninstall a plugin, edit my.cnf, and install the plugin again. Restarting the plugin this way enables it to the new option values without a server restart.

Before MySQL 5.1.33, a plugin is started with each option set to its default value.

INSTALL PLUGIN also loads and initializes the plugin code to make the plugin available for use. A plugin is initialized by executing its initialization function, which handles any setup that the plugin must perform before it can be used.

To use INSTALL PLUGIN, you must have the INSERT privilege for the mysql.plugin table.

At server startup, the server loads and initializes any plugin that is listed in the mysql.plugin table. This means that a plugin is installed with INSTALL PLUGIN only once, not every time the server starts. Plugin loading at startup does not occur if the server is started with the --skip-grant-tables option.

When the server shuts down, it executes the deinitialization function for each plugin that is loaded so that the plugin has a change to perform any final cleanup.

If you need to load plugins for a single server startup when the --skip-grant-tables option is given (which tells the server not to read system tables), use the --plugin-load option.

Examples:

MariaDB [(none)]> INSTALL PLUGIN sphinx SONAME 'ha_sphinx.so';
Query OK, 0 rows affected (0.00 sec)

# starting from 5.5.21 one can also write
MariaDB [(none)]> INSTALL PLUGIN innodb SONAME 'ha_xtradb';
Query OK, 0 rows affected (0.00 sec)

See Also:

Commenti

Sto caricando i commenti......
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.