CertGrid CertGrid
Hands-on Lab·MySQL

MySQL Account Locking, Revocation and Removal

Locking an account is reversible and keeps its grants; dropping it is neither. `ERROR 3118` is what a locked account looks like from outside, and it is distinct from a wrong password.

Users and Privileges Guide 20 of 45 Intermediate

Written against the versions above. `ACCOUNT LOCK` is 5.7.6+. Before that, offboarding meant dropping the account or changing its password, both of which lose information.

Every command on this page ran on db-a01.
Server NameIP AddressOSRolesCPURAMHDD
db-a01192.168.0.81Ubuntu 26.04 LTSPrimary / Source / Replica Set Member 12 Core4 GB50 GB

Before you start

  1. Lock an account without destroying anything

  2. See what a locked account looks like from outside

  3. Unlock it

  4. Revoke a privilege and watch USAGE remain

  5. Drop the account for good

Official sources