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

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

This guide includes

Use this when an account has to stop working. This matters because locking is reversible and keeps every grant, while dropping is neither - and REVOKE leaves USAGE behind, which catches people out.

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