阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

MySQL 5.6锁定用户

162次阅读
没有评论

共计 676 个字符,预计需要花费 2 分钟才能阅读完成。

MySQL 5.7 加入了 LOCK ACCOUNT 功能和 Oracle 一样了,但是 MySQL 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 标示了是否过期。

本文永久更新链接地址 :http://www.linuxidc.com/Linux/2016-07/133394.htm

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-22发表,共计676字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中