Occasionally, you will want to lock a MySQL user from utilizing the MySQL databases it is assigned to, or unlock them to give them access again.
The MySQL user information is a part of the system-level MySQL database, and can only be modified by root. To login to MySQL as root, do the following:
The following command will lock a user that already exists:
ALTER USER 'db_user'@'localhost' ACCOUNT LOCK;
To unlock a user use the following:
ALTER USER 'db_user'@'localhost' ACCOUNT UNLOCK;