MySQL参数解析 password_require_current

数据库   发布日期:2023年05月27日   浏览次数:251

password_require_current:

作用范围:Global

动态修改:Yes

取值范围:ON,OFF

默认值:OFF

来看下面的示例,password_require_current=ON设置下,修改密码没有指定旧密码,报错,使用replace子句指定旧密码,再次执行,成功。

mysql> alter user app@'%' identified by 'cC@12345678';

ERROR 3892 (HY000): Current password needs to be specified in the REPLACE clause in order to change it.

mysql> alter user app@'%' identified by 'cC@12345678' replace 'bB@12345678';

Query OK, 0 rows affected (0.01 sec)

除了使用参数password_require_current来控制全局的密码修改策略外,还可以在create user和alter user语句中,使用password require current子句单独控制某个用户的密码修改策略,如下所示:

create user app1@’%’ identified by ‘aA@12345678’ password require current;

create user app2@’%’ identified by ‘aA@12345678’ password require current optional;

create user app3@’%’ identified by ‘aA@12345678’ password require current default;

以上就是MySQL参数解析 password_require_current的详细内容,更多关于MySQL参数解析 password_require_current的资料请关注九品源码其它相关文章!