ITPub博客

首页 > 数据库 > MySQL > MYSQL 5.6锁定用户

MYSQL 5.6锁定用户

原创 MySQL 作者:gaopengtttt 时间:2016-07-15 15:17:32 0 删除 编辑
5.7加入了LOCK ACCOUNT功能和ORACLE一样了,
但是5.6貌似没有,但是可以代替用如下方法设置密码过期。
The mysql.usertable now has a password_expiredcolumn. Its default value is 'N', but
can be set to 'Y'with the new ALTER USER statement. After an account's password has been
expired, all operations performed in subsequent connections to the server using the account result
in an error until the user issues a SET PASSWORDstatement to establish a new account password.
For more information, see Section 13.7.1.1, “ALTER USERSyntax”, and Section 6.3.6, “Password
Expiration and Sandbox Mode”.
就是下面这个语法
mysql> alter user mytest1@'%' password expire;
如果要恢复
set password for mytest1@'%' = '*******';

其实就是MYSQL.USER下面的字段 password_expired 标示了是否过期。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/7728585/viewspace-2122068/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
wxh gp_22389860 公众号 MySQL学习 书籍 深入理解MySQL主从原理

注册时间:2021-06-07

  • 博文量
    868
  • 访问量
    3495594