6.4.3.3 Transitioning to the Password Validation Component转换到密码验证组件

Note注意

In MySQL 8.0, the validate_password plugin was reimplemented as the validate_password component. The validate_password plugin is deprecated; expect it to be removed in a future version of MySQL.在MySQL 8.0中,validate_password插件被重新实现为validate_password组件。validate_password插件已弃用;预计它将在MySQL的未来版本中被删除。

MySQL installations that currently use the validate_password plugin should make the transition to using the validate_password component instead. 当前使用validate_password插件的MySQL安装应转换为使用validate_password组件。To do so, use the following procedure. The procedure installs the component before uninstalling the plugin, to avoid having a time window during which no password validation occurs.为此,请使用以下程序。该过程在卸载插件之前安装组件,以避免出现不进行密码验证的时间窗口。 (The component and plugin can be installed simultaneously. In this case, the server attempts to use the component, falling back to the plugin if the component is unavailable.)(组件和插件可以同时安装。在这种情况下,服务器会尝试使用组件,如果组件不可用,则退回插件。)

  1. Install the validate_password component:安装validate_password组件:

    INSTALL COMPONENT 'file://component_validate_password';
  2. Test the validate_password component to ensure that it works as expected. 测试validate_password组件以确保其按预期工作。If you need to set any validate_password.xxx system variables, you can do so at runtime using SET GLOBAL. 如果需要设置任何validate_password.xxx系统变量,可以在运行时使用SET GLOBAL进行设置。(Any option file changes that must be made are performed in the next step.)(必须进行的任何选项文件更改都将在下一步中执行。)

  3. Adjust any references to the plugin system and status variables to refer to the corresponding component system and status variables. Suppose that previously you had configured the plugin at startup using an option file like this:调整对插件系统和状态变量的任何引用,以引用相应的组件系统和状态参数。假设您之前在启动时使用如下选项文件配置了插件:

    [mysqld]
    validate-password=FORCE_PLUS_PERMANENT
    validate_password_dictionary_file=/usr/share/dict/words
    validate_password_length=10
    validate_password_number_count=2

    Those settings are appropriate for the plugin, but must be modified to apply to the component. 这些设置适用于插件,但必须进行修改才能应用于组件。To adjust the option file, omit the --validate-password option (it applies only to the plugin, not the component), and modify the system variable references from no-dot names appropriate for the plugin to dotted names appropriate for the component:要调整选项文件,请省略--validate密码选项(它仅适用于插件,不适用于组件),并将系统变量引用从不适用于插件的点名称修改为适用于组件的点名称:

    [mysqld]
    validate_password.dictionary_file=/usr/share/dict/words
    validate_password.length=10
    validate_password.number_count=2

    Similar adjustments are needed for applications that refer at runtime to validate_password plugin system and status variables. Change the no-dot plugin variable names to the corresponding dotted component variable names.对于在运行时引用validate_password插件系统和状态变量的应用程序,也需要进行类似的调整。将无点插件变量名更改为相应的点组件变量名。

  4. Uninstall the validate_password plugin:卸载validate_password插件:

    UNINSTALL PLUGIN validate_password;UNINSTALL插件验证密码;

    If the validate_password plugin is loaded at server startup using a --plugin-load or --plugin-load-add option, omit that option from the server startup procedure. For example, if the option is listed in a server option file, remove it from the file.如果在服务器启动时使用--plugin-load--plugin-load-add选项加载validate_password插件,请在服务器启动过程中省略该选项。例如,如果该选项列在服务器选项文件中,请将其从文件中删除。

  5. Restart the server.重新启动服务器。