MySQL 8.0.19支持输入3次错误密码,锁定账户功能
例子:
>CREATE USER 'hechunyang'@'localhost' IDENTIFIED BY '123456' FAILED_LOGIN_ATTEMPTS 3 PASSWORD_LOCK_TIME 3;
FAILED_LOGIN_ATTEMPTS:代表尝试失败的次数
PASSWORD_LOCK_TIME:代表锁定的时间,单位天,这里为锁定3天。
如果设置UNBOUNDED,代表锁定永久,直到手工解锁。
故意输错3次以上密码,账户被锁定,如下所示:
# mysql -hlocalhost -uhechunyang -p123456789 -S /tmp/mysql_hcy.sock mysql: [Warning] Using a password on the command line interface can be insecure. ERROR 3955 (HY000): Access denied for user 'hechunyang'@'localhost'. Account is blocked for 3 day(s) (3 day(s) remaining) due to 3 consecutive failed logins.
手工解锁:
alter user hechunyang@'localhost' ACCOUNT UNLOCK;
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。