MYSQL 5.6鎖定使用者

gaopengtttt發表於2016-07-15
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部落格 ” ,連結:http://blog.itpub.net/7728585/viewspace-2122068/,如需轉載,請註明出處,否則將追究法律責任。

相關文章