组件必须在使用前加载到服务器中。MySQL 支持在运行时手动加载组件以及在服务器启动时自动加载组件。Components must be loaded into the server before they can be used. MySQL supports manual component loading at runtime and automatic loading during server startup.
当组件被加载时,有关该组件的信息可按第 7.5.2 节,“获取组件信息”的描述获得。While a component is loaded, information about it is available as described in Section 7.5.2, “Obtaining Component Information”.
INSTALL COMPONENT 和 UNINSTALL COMPONENT SQL 语句用于组件的加载和卸载。例如:The INSTALL COMPONENT and
UNINSTALL COMPONENT SQL statements
enable component loading and unloading. For example:
INSTALL COMPONENT 'file://component_validate_password'; UNINSTALL COMPONENT 'file://component_validate_password';
加载器服务负责组件的加载和卸载,同时将加载的组件注册到 mysql.component 系统表中。A loader service handles component loading and unloading, and also
registers loaded components in the
mysql.component system table.
组件在服务器本地加载(不进行复制)。Components are loaded in the server locally (not replicated).
用于组件操作的 SQL 语句会影响服务器运行以及 mysql.component 系统表,如下所示:The SQL statements for component manipulation affect server
operation and the mysql.component system table
as follows:
INSTALL COMPONENT将组件加载到服务器中。组件会立即生效。加载服务还会在mysql.component系统表中注册已加载的组件。在随后的服务器重启过程中,加载服务会在启动序列中加载mysql.component中列出的任何组件。即使服务器以--skip-grant-tables选项启动,这一过程仍会发生。可选的SET子句允许在安装组件时设置组件系统变量的值。INSTALL COMPONENTloads components into the server. The components become active immediately. The loader service also registers loaded components in themysql.componentsystem table. For subsequent server restarts, the loader service loads any components listed inmysql.componentduring the startup sequence. This occurs even if the server is started with the--skip-grant-tablesoption. The optionalSETclause permits setting component system-variable values when you install components.UNINSTALL COMPONENT会停用组件并将其从服务器卸载。加载服务还会从mysql.component系统表中注销这些组件,因此服务器在随后的重启过程中将不再加载它们。UNINSTALL COMPONENTdeactivates components and unloads them from the server. The loader service also unregisters the components from themysql.componentsystem table so that the server no longer loads them during its startup sequence for subsequent restarts.
与用于服务器插件的相应 INSTALL
PLUGIN 语句相比,用于组件的 INSTALL COMPONENT 语句具有显著优势,即不需要知道任何特定平台的文件名后缀来命名组件。这意味着可以在各个平台上统一执行给定的 INSTALL COMPONENT 语句。Compared to the corresponding INSTALL
PLUGIN statement for server plugins, the
INSTALL COMPONENT statement for
components offers the significant advantage that it is not
necessary to know any platform-specific file name suffix for
naming the component. This means that a given
INSTALL COMPONENT statement can be
executed uniformly across platforms.
安装组件时,可能会自动安装相关的可加载功能。如果是这样,卸载组件时也会自动卸载这些功能。A component when installed may also automatically install related loadable functions. If so, the component when uninstalled also automatically uninstalls those functions.