MySQL Variables default_authentication_plugin 数据库 参数变量解释及正确配置使用

本站中文解释

用途

default_authentication_plugin是MySQL的参数变量,用于指定MySQL的验证插件的类型。其可设置的参数有mysql_native_password、sha256_password、caching_sha2_password。

设置该变量的方式如下:

1、在MySQL中执行命令
SET GLOBAL default_authentication_plugin = ‘插件类型’;

2、修改MySQL配置文件my.cnf中[mysqld]节点下default-authentication-plugin参数值。

例如:default-authentication-plugin=caching_sha2_password

3、重启MySQL服务

官方英文解释

default_authentication_plugin

Command-Line Format --default-authentication-plugin=plugin_name
System Variable default_authentication_plugin
Scope Global
Dynamic No
Type Enumeration
Default Value mysql_native_password
Valid Values

mysql_native_password

sha256_password

The default authentication plugin. These values are permitted:

  • mysql_native_password: Use MySQL native
    passwords; see
    Section 6.4.1.1, “Native Pluggable Authentication”.

  • sha256_password: Use SHA-256 passwords;
    see Section 6.4.1.5, “SHA-256 Pluggable Authentication”.

Note

If this variable has a value other than
mysql_native_password, clients older than
MySQL 5.5.7 cannot connect because, of the permitted default
authentication plugins, they understand only the
mysql_native_password authentication
protocol.

The
default_authentication_plugin
value affects these aspects of server operation:

  • It determines which authentication plugin the server
    assigns to new accounts created by
    CREATE USER and
    GRANT statements that do
    not explicitly specify an authentication plugin.

  • The old_passwords system
    variable affects password hashing for accounts that use
    the mysql_native_password or
    sha256_password authentication plugin.
    If the default authentication plugin is one of those
    plugins, the server sets
    old_passwords at startup
    to the value required by the plugin password hashing
    method.

  • For an account created with either of the following
    statements, the server associates the account with the
    default authentication plugin and assigns the account the
    given password, hashed as required by that plugin:

    CREATE USER ... IDENTIFIED BY 'cleartext password';
    GRANT ...  IDENTIFIED BY 'cleartext password';
    
  • For an account created with either of the following
    statements, the server associates the account with the
    default authentication plugin and assigns the account the
    given password hash, if the password hash has the format
    required by the plugin:

    CREATE USER ... IDENTIFIED BY PASSWORD 'encrypted password';
    GRANT ...  IDENTIFIED BY PASSWORD 'encrypted password';
    

    If the password hash is not in the format required by the
    default authentication plugin, the statement fails.


数据运维技术 » MySQL Variables default_authentication_plugin 数据库 参数变量解释及正确配置使用