Warning: ftp_fget() expects parameter 1 to be resource, null given in /www/wwwroot/new.weijing.co/wp-admin/includes/class-wp-filesystem-ftpext.php on line 146

MySQL 参数解析 password_require_current

password_require_current 是 MySQL 8.0.13 版本引入的新参数,该参数定义了一个密码修改的全局策略,如果该参数设置为ON,在修改账号的密码时,会要求指定账号当前使用的密码。简单来说,就是设置新密码时,需要给出旧密码。
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;

发表评论

您的电子邮箱地址不会被公开。

Shopping Cart