dcsimg
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Tip: Locking a User Account in MySQL

MySQL provides a mechanism to alter the user properties, thereby allowing you to lock the user account.


advertisement

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


After a user has been created and is currently in use, a need might arise for the user account to be locked. MySQL provides a mechanism to alter the user properties, thereby allowing you to lock the user account.

Assuming that the user 'dboperator' was already created, we will execute the ALTER query below to lock the user.

Query:

ALTER USER dboperator ACCOUNT LOCK;

To verify, the same, use below query.

SELECT user, host, account_locked FROM mysql.user WHERE user='dboperator';

Output:

+--------------------------------------+
| user        | host  | account_locked |
+--------------------------------------+
| dboperator  | %     |  Y             |
+--------------------------------------+

 

Visit the DevX Tip Bank

 





   
Sridhar M S. is a Java developer from Bangalore, India. He holds a master's degree in Computer Science.
Thanks for your registration, follow us on our social networks to keep up-to-date