MySQL5.7 锁定用户【转】

时间:2021-06-16 09:43:24
使用ALTER USER 语句锁定

mysql>ALTER USER 'demo'@'localhost' ACCOUNT LOCK;
Query OK, 0 rows affected (0.00 sec)

使用被锁账号登录会报ERROR 3118错误:

$ mysql -udemo -p
Enter password:
ERROR 3118 (HY000): Access denied for user 'demo'@'localhost'. Account is locked.

解锁账号

mysql>ALTER USER 'demo'@'localhost' ACCOUNT UNLOCK;
Query OK, 0 rows affected (0.00 sec)

 

转自

MySQL 5.7账号锁定Account Lock https://majing.io/posts/10000004771184