LOCK User
Identify a user account that needs to be locked. The ALTER USER command in MySQL includes an ACCOUNT option to control user access. It is used to either lock or unlock a user account, effectively enabling or disabling login capabilities.
Syntax:
ALTER USER <username>@<host-name> ACCOUNT LOCK
Example
ALTER USER "gfg"@"localhost" ACCOUNT LOCK
The above command will lock the user named with gfg. Since we locked the user(gfg) we can’t able to login into gfg account.
MYSQL Unlock Account
In today’s data-driven world, successful organizations require the ability to process and manipulate data effectively as part of their business foundation. Structured Query Language (SQL) is a powerful tool that enables users to manipulate relational databases. Within SQL, there is an entity where data can be stored, retrieved, and manipulated.
In this article, we will explore the steps to unlock a locked user account in MySQL. Unlocking a user account in MySQL refers to restoring access to the user who has been temporarily restricted from logging in due to certain security measures or some other reasons. To unlock a user account in MySQL, administrators utilize the ALTER USER statement. which allows to change of user account properties, including unlocking the account.