SELECT PLUGIN_NAME, PLUGIN_STATUS, plugin_library, load_option FROM INFORMATION_SCHEMA.PLUGINS WHERE plugin_library = 'validate_password.so'; mysql> show plugins;
根据需求配置密码策略
1 检查策略变量配置
mysql> SHOW VARIABLES LIKE 'validate_password%'; +--------------------------------------+--------+ | Variable_name | Value | +--------------------------------------+--------+ | validate_password_check_user_name | OFF | | validate_password_dictionary_file | | | validate_password_length | 8 | | validate_password_mixed_case_count | 1 | | validate_password_number_count | 1 | | validate_password_policy | MEDIUM | | validate_password_special_char_count | 1 | +--------------------------------------+--------+
1 账号密码过期,需修改密码 遇到场景:ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
# 1. 注意密码策略要求 validate_password_policy 等 show variables like 'validate_password%';
# 2. 依据密码策略要求修改密码 /* -- 2.1 如果密码与Server的策略要求不一致时,临时修改策略及密码后恢复密码策略 set global validate_password_policy=0; set global validate_password_length=1; */ alter user 'root'@'localhost' identified by 'root'; /* set global validate_password_policy=1; set global validate_password_length=8; */ flush privileges;
-- 2.2 密码符合要求 alter user 'root'@'localhost' identified by 'R#isn218aio'; flush privileges;