Steps to UNLOCK User
To manage user account statuses, such as locking or unlocking, you must log a in to MySQL account which has the administrative privileges, Only DB Admin has access to UNLOCK or LOCK the user. For instance, I am login into my root account.
Identify the user account that needs to be unlock. The mysql.user table has all user-related data in MySQL. To Identify which user accounts require unlocking, a query can be executed to select the usernames and their corresponding account statuses on mysql.user table.
To unlock a user account in MySQL, the ALTER USER statement is executed with the ACCOUNT UNLOCK clause. This action restores the user’s ability to log in to the database. The command requires the username and, if necessary, the hostname.
Syntax:
ALTER USER “username@hostname” ACCOUNT UNLOCK
After executing the above command, we attempted to log in to the ‘gfg’ account through CLI and were 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.